Django. How to display all fields from the model to the template instead of listing them?

A model in which many fields. About 20 pieces, various types, including FileField. How to use the For loop output in the template, not to amend the template each time you edit the model?
Use The DetailView. I would like to see in the pattern something like this:
{% for field in some_model.fields %}
 {{ field.name }}: {{ field.value }}
 {% endfor %}
April 19th 20 at 12:11
2 answers
April 19th 20 at 12:13
Will be for you, the search query "django model get fields"
Yes, but the question is can it be done at the template level? All examples on this query, I have looked. To the field in code view function problems and so was not. The pattern of such elements of the type model. _meta. get_fields() during no. - Eliseo43 commented on April 19th 20 at 12:16
@Eliseo43in django template will swear by _, as in jinja, I don't know. So what's stopping you to do it in views, or even add a method to the model. Templates in General should be simple. - zack commented on April 19th 20 at 12:19
April 19th 20 at 12:15
Make a template tag is essentially a function that accepts an instance of any model. Using obj._meta.get_fields() run through the fields and return to the template data received in the desired form.

Find more questions by tags Jinja2Django