jazzband / django-formtools

A set of high-level abstractions for Django forms
https://django-formtools.readthedocs.io
BSD 3-Clause "New" or "Revised" License
797 stars 135 forks source link

is it possible to use grainy form using django widget tweak #174

Closed CARocha closed 3 years ago

CARocha commented 3 years ago

I have a model with 9 fields, I have created 3 forms (ModelForms) to use with the wizard but I would like to have control of each field, is it possible to do it with formstools? I put an example of what I want to do is possible in each step.

{{ wizard.management_form }} {% if wizard.steps == 1 %} {% render_field wizard.form.field_1 class+="css_class_1 css_class_1" %} {% render_field wizard.form.field_2 class+="css_class_1 css_class_2" %} {% render_field wizard.form.field_3 class+="css_class_1 css_class_3" %} {% endif %} {% if wizard.steps == 2 %} {% render_field wizard.form.field_4 class+="css_class_1 css_class_4" %} {% render_field wizard.form.field_5 class+="css_class_1 css_class_5" %} {% render_field wizard.form.field_6 class+="css_class_1 css_class_6" %} {% endif %} {% if wizard.steps == 3 %} {% render_field wizard.form.field_7 class+="css_class_1 css_class_7" %} {% render_field wizard.form.field_8 class+="css_class_1 css_class_8" %} {% render_field wizard.form.field_9 class+="css_class_1 css_class_9" %} {% endif %}

i am using only 1 template is possible??

Cheers

CARocha commented 3 years ago

I have turned out like this {% if wizard.steps.step1 == 1 %} {% render_field wizard.form.field_1 class+="css_class_1 css_class_1" %} {% endif %}