Top "Django-templates" questions

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

How do I perform query filtering in django templates

I need to perform a filtered query from within a django template, to get a set of objects equivalent to …

python django django-templates
Reference list item by index within Django template?

This may be simple, but I looked around and couldn't find an answer. What's the best way to reference a …

python django django-templates
How to put comments in Django templates

I would like to comment this with a line {% if something.property %} <table> <tr>... {% # this is …

django django-templates
How to call function that takes an argument in a Django template?

I'm passing to Django's template a function, which returns some records. I want to call this function and iterate over …

python django function variables django-templates
How to POST a django form with AJAX & jQuery

I've checked out tons of tutorials for django AJAX forms, but each one of them tells you one way of …

javascript jquery ajax django django-templates
What is the equivalent of "none" in django templates?

I want to see if a field/variable is none within a Django template. What is the correct syntax for …

python django django-forms django-templates django-views
How to create password input field in django

Hi I am using the django model class with some field and a password field. Instead of displaying regular plain …

django django-models django-forms django-templates django-views
How to do math in a Django template?

I want to do this: 100 - {{ object.article.rating_score }} So for example, the output would be 20 if {{ object.article.…

python django django-templates
How do I add multiple arguments to my custom template filter in a django template?

Here's my custom filter: from django import template register = template.Library() @register.filter def replace(value, cherche, remplacement): return value.…

django django-templates
Django: How do I add arbitrary html attributes to input fields on a form?

I have an input field that is rendered with a template like so: <div class="field"> {{ form.city }} &…

django django-templates django-forms django-widget html