Good afternoon, here I want to clarify for myself what is better, more precisely, preferable, “draw” the form itself or just use from django import forms , and in html simply output {{ form }} , since and a no-brainer that if you have only a couple of fields, you can not really invent it and output it via {{ form }} , and if I have a dozen fields, where I need to enter numbers and strings and make a choice from selects ....

Closed due to the fact that it is necessary to reformulate the question so that it was possible to give an objectively correct answer to the participants Grundy , Pavel Parshin , Vladimir Martyanov , aleksandr barakin , user194374 16 Feb '16 at 13:18 .

The question gives rise to endless debates and discussions based not on knowledge, but on opinions. To get an answer, rephrase your question so that it can be given an unambiguously correct answer, or delete the question altogether. If the question can be reformulated according to the rules set out in the certificate , edit it .

    1 answer 1

    There are quite a few possibilities for customizing forms.
    In forms you can specify the desired widgets for the fields. In templates, you can use built-in methods for forms.

     {{ form.as_p }} {{ form.as_table }} 

    You can access specific fields and add them to the desired tags.

     <p>{{ form.some_field }}</p> 

    You can use batteries like crispy_forms

    It is best to read the documentation on the forms and choose something suitable for your problem.

    • Well, yes, the documentation itself is saboy, but for now I am inclined that it is easier for me to draw the form myself, although I want to do it through forms and then immediately there is a problem with css, it’s easy to connect attrs somewhere, and somewhere like ChoiceField, I get an error object has no attribute 'is_hidden'. - ItaRi
    • The syntax for patterning is jinja? - Nick Volynkin
    • @NickVolynkin not, standard - Ivan Semochkin February
    • @Baterson looked. It seems that both of us are right: Jinja is the standard syntax of templating in Python)) en.wikipedia.org/wiki/Jinja_%28template_engine%29 . Django in Python - Nick Volynkin
    • @NickVolynkin I wanted to say that this is the default template language Django, Jinja should be connected separately django.template.backends.jinja2.Jinja2 - Ivan Semochkin