Top "Django-templates" questions

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

Displaying uploaded images in the template - Django

I am trying to display uploaded images to a template for my imaginary vegetable catalogue. I have a page to …

django django-templates pillow django-related-manager
django-multilingual and switching between languages on template side

I am trying to use django-multilingual and setup it properly. But what I found is that everything is clear for …

django django-templates django-multilingual
Handlebars.js in Django templates

I need a javascript templating system and i think handlebars.js does an excellent job in this case. I'm having …

django django-templates handlebars.js
set initial value in CreateView from ForeignKey (non-self.request.user)

I am attempting to access ForeignKeys in Class Based Views CreateView. I would like to be able to dynamically set …

django django-templates foreign-keys django-class-based-views
How to check whether a user is online in django template?

In template, when I use {% if topic.creator.is_authenticated %} Online {% else %} Offline {% endif %} the users turn out to be …

django django-templates django-sessions
Social media link in Django

I want to set a social link at the end of my post in the Django template. how to use …

python django django-templates facebook-social-plugins python-social-auth
Django FormView does not have form context

When defining a FormView derived class: class PrefsView(FormView): template_name = "prefs.html" form_class = MyForm # What's wrong with this? …

django view django-templates formview django-context
How can I concatenate forloop.counter to a string in my django template

I am already trying to concatenate like this: {% for choice in choice_dict %} {% if choice =='2' %} {% with "mod"|add:…

python django django-templates for-loop string-concatenation
DJANGO: ModelChoiceField optgroup tag

How can I set in ModelChoiceField optgroup tag? This is example: models.py class Link(models.Model): config = models.ForeignKey(…

python django django-templates django-forms
DetailView template not displaying model data

I have a model which I want to display as a Detail view, I have created a list view that …

django django-templates django-views django-class-based-views