You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1 QUESTION: How to use django-tweaks with MultipleChoiceField field?
2QUESTION: I have form with MultipleChoiceField field which has dynamic list for choices. Sometimes dynamic list can be empty []. So I want to show message in template when its empty but next code didnt show message.
forms.py:
class RequirementForm(forms.ModelForm):
symbol = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple)
class Meta:
model = Requirement
fields = ('symbol',)
requirement_add.html:
{% load widget_tweaks %}
<form method="post" action="{% url 'project:requirement_add' project_code=project.code %}">
{% for field in form %}
{% render_field field class="form-control" %}
{% empty %}
<p>Form is empty!</p>
{% endfor %}
</form>
The text was updated successfully, but these errors were encountered:
nurzhannogerbek
changed the title
How to use django-tweaks with MultipleChoiceField field?
How to use django-widget-tweaks with MultipleChoiceField field?
May 1, 2017
1 QUESTION: How to use django-tweaks with MultipleChoiceField field?
2QUESTION: I have form with MultipleChoiceField field which has dynamic list for
choices
. Sometimes dynamic list can be empty []. So I want to show message in template when its empty but next code didnt show message.forms.py:
requirement_add.html:
The text was updated successfully, but these errors were encountered: