how to create dependent choices in uniforms in django code example
Example 1: django form list option
# iterable
GEEKS_CHOICES =(
("1", "One"),
("2", "Two"),
("3", "Three"),
("4", "Four"),
("5", "Five"),
)
# creating a form
class GeeksForm(forms.Form):
geeks_field = forms.ChoiceField(choices = GEEKS_CHOICES)
Example 2: dropdown using ajax and django
{% for c in colors %} <option value="{{ c.color }}">{{ c.color|title }}</option>{% endfor %}