Answer the question
In order to leave comments, you need to log in
Django. How to display all model fields in a template without listing them?
There is a model in which it is a lot of fields. About 20 pieces, different types, including FileField. How to display them in the template using the For loop so as not to make changes to the template every time the model is edited?
I am using DetailView. I would like to see something like this in the template:
{% for field in some_model.fields %}
{{ field.name }}: {{ field.value }}
{% endfor %}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question