D
D
Dev_nab2021-10-17 19:30:40
Django
Dev_nab, 2021-10-17 19:30:40

How to make some form fields text, field.value?

There is a form with fields title, create, text, ... etc. (pieces 10 fields)

in the template

{% for field in form %}
     {% if field.label == 'Дата создания' %}
          {{ field.value }}
     {% else %}
          {{ field }}
     {% endif %}
{% endfor %}


How to make some fields have {{ field.value }}, others just {{ field }}?

You won't write [% if field.label == 'Date of creation' %} for each field...
Do you need to write something in forms.py?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question