Top "Django-templates" questions

Questions about the template engine of Django, which is intended to separate the presentation of a document from its data.

Assign variables to child template in {% include %} tag Django

I have this code(which doesn't give me expected result) #subject_content.html {% block main-menu %} {% include "subject_base.html" %} {% endblock %} #…

html django variables include django-templates
Django templates: verbose version of a choice

I have a model: from django.db import models CHOICES = ( ('s', 'Glorious spam'), ('e', 'Fabulous eggs'), ) class MealOrder(models.Model): …

django django-templates django-forms
Django templates folders

I'm experimenting with Django, and figuring out how to set urls.py, and how the URLs work. I've configured urls.…

django django-templates django-urls
How to check if django template variable is defined?

I have a django template which is used from many views. The template has a block for messages used to …

django django-templates
Sorting related items in a Django template

Is it possible to sort a set of related items in a DJango template? That is: this code (with HTML …

python django django-templates sql-order-by
How do you insert a template into another template?

I have a very basic template (basic_template.html), and want to fill in the with data formatted using another …

html django django-templates
Django FileField: How to return filename only (in template)

I've got a field in my model of type FileField. This gives me an object of type File, which has …

django django-templates django-file-upload
Django request to find previous referrer

I am passing the request to the template page.In django template how to pass the last page from which …

django django-models django-templates django-views
How to compare dates in Django templates

I would like to compare a date to the current date in Django, preferably in the template, but it is …

python django django-templates
django template if or statement

Basically to make this quick and simple, I'm looking to run an XOR conditional in django template. Before you ask …

python django if-statement django-templates xor