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 to set a value of a variable inside a template code?

Say I have a template <html> <div>Hello {{name}}!</div> </html> While …

django django-templates
How to get the current URL within a Django template?

I was wondering how to get the current URL within a template. Say my current URL is: .../user/profile/ How …

django django-templates
Django - iterate number in for loop of a template

I have the following for loop in my django template displaying days. I wonder, whether it's possible to iterate a …

django for-loop django-templates
Numeric for loop in Django templates

How do I write a numeric for loop in a Django template? I mean something like for i = 1 to n

django django-templates
Django Template Variables and Javascript

When I render a page using the Django template renderer, I can pass in a dictionary variable containing various values …

javascript python django google-app-engine django-templates
How to access a dictionary element in a Django template?

I would like to print out the number of votes that each choice got. I have this code in a …

python django django-templates
How can I change the default Django date template format?

I have dates in ISO 8601 format in the database, %Y-%m-%d. However, when the date is passed on to …

django django-templates
Iterate over model instance field names and values in template

I'm trying to create a basic template to display the selected instance's field values, along with their names. Think of …

python django django-templates
How do I include image files in Django templates?

I'm new to Django and I'm trying to learn it through a simple project I'm developing called 'dubliners' and an …

python django django-templates
Django: Display Choice Value

models.py: class Person(models.Model): name = models.CharField(max_length=200) CATEGORY_CHOICES = ( ('M', 'Male'), ('F', 'Female'), ) gender = models.CharField(…

python django django-models django-templates