본문 바로가기

Python_WEB/Try_Django

[Django]Built-In Template Tags

반응형

CodingEntrepreneurs Django 강의 정리

{% if %} {% endif %}>

1. 해당 변수가 "참"이면(즉, 존재하고, 비어 있지 않고, 거짓 부울 값이 아닌 경우)블록의 내용을 실행한다.

가이드

 

{% for %} {% endfor %}>

1. 루프

가이드

 

home.html>

{% extends "base.html" %}

{% block content %}

{{ title }}

{{ request.user }}

{{ request.path }}

{{ user }}

{{ user.is_authenticated }}
{% if user.is_authenticated %}

<h1> User Only data</h1>
{% for a in my_list %}
<li>{{ a }}</li>
{% endfor %}

{% endif %}

{% endblock %}

 

적용 스크린샷>

반응형

'Python_WEB > Try_Django' 카테고리의 다른 글

[Django]Save to the Database  (0) 2020.06.14
[Django]Your First App  (0) 2020.06.14
[Django]Template Context Processors  (0) 2020.06.14
[Django]Rendering Any Kind of Template  (0) 2020.06.14
[Django]Stay DRY with Templates  (0) 2020.06.14