Django Template - zamaniamin/python GitHub Wiki

Template

Templates are store in <project_directory>/templates or in your <app_name>/templates/<app_name>/*.html

{% extends 'base.html' %}
{% block content %}     
{% endblock %} 

{% include 'header.html' %} 

{% if user.username = 'Mike' %}
    <p>Hello Admin</p>   
{% else %}   
    <p>Hello User</p>
{% endif %} 

{% for product in products %}   
  <p>The product name is {{ product }}<p>
{% endfor %} 

{{ var_name }}

Template variables formating
{{ title | lower }} 
{{ blog.post | truncatwords:50 }}
{{ order.date | date:"D M Y" }}
{{ list_items | slice:":3" }}
{{ total | default:"nil" }}

Current path (ex. posts/1/show)
{{ request.path }}   

URL by name with param
{% url 'posts.delete' id=post.id %}

Use static in template: 
{% load static %}
{% static 'css/main.css' %} 
⚠️ **GitHub.com Fallback** ⚠️