Skip to content Skip to sidebar Skip to footer

Django Multiplechoicefield Not Rending On Page

I'm trying to get a form that takes in a name and month and will return students with that name and month (attendance system). I'm using a MultipleChoiceField for the form but it d

Solution 1:

Materialize CSS expects to see tags with a class="browser-default". However Django forms do not add the class. So the following must be passed in forms.py:

classattendenceFinder(forms.Form):
    months = ((1, 'JAN'),
              (2, 'FEB'),
              (3, 'MAR'),
              (4, 'APR'),
              (5, 'MAY'),
              (6, 'JUN'),
              (7, 'JUL'),
              (8, 'AUG'),
              (9, 'SEP'),
              (10, 'OCT'),
              (11, 'NOV'),
              (12, 'DEC')
    )
 month = forms.MultipleChoiceField(choices=months, widget=forms.Select(
            choices=months,
            attrs={'class': 'browser-default'}))

All credit goes to this link:

https://github.com/Dogfalo/materialize/issues/4904

Solution 2:

Django material very helpful for the form rendering that use Materializecss . Here is the link to project https://github.com/viewflow/django-material.

Post a Comment for "Django Multiplechoicefield Not Rending On Page"