Top "Django-templates" questions

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

Django how to partial render

How do I call a view method from a template level like partial render in RoR? The problem is perfectly …

django django-templates django-views
How to access outermost forloop.counter with nested for loops in Django templates?

Is it possible to access the forloop.counter for the outermost for loop in the following template in Django: {% for …

django django-templates
How do you limit list objects template side, rather than view side

One of the ways to limit objects is to add a limitation to a function like this def ten_objects(): …

django django-templates
_() or {% trans %} in Django templates?

In Django templates, you can use either {{ _("Hello World") }} or {% trans "Hello World" %} to mark strings to be translated. In …

django internationalization django-templates translation
how to point correctly to static image in django

I have a template that renders an image: {% load staticfiles %} <img src="{% static "img/logo.png" %}" alt="My image"/&…

django django-templates django-staticfiles django-settings
How do I access the properties of a many-to-many "through" table from a django template?

From the Django documentation... When you're only dealing with simple many-to-many relationships such as mixing and matching pizzas and toppings, …

python django django-templates many-to-many relationship
How do you use get_context_data with TemplateView in Django

I'm trying to do something like this: class AboutView(TemplateView): template_name = 'about.html' def get_context_data(self, **kwargs): …

django django-templates django-views django-class-based-views
How to render menu with one active item with DRY?

I would like to render a constructions like: <a href='/home'>Home</a> <span …

django django-templates
Alternate Row Coloring in Django Template with More Than One Set of Rows

Django templates offer the builtin tag cycle for alternating between several values at different points in a template (or for …

django django-templates
Getting Eclipse to open .html in text-editor by default?

Eclipse Juno keeps opening my HTML files in a embedded web-browser, rather than in an embedded syntax-highlighting editor. I have …

eclipse django-templates html-editor eclipse-juno default-parameters