I\'m trying to create a dynamic list of choices for the ChoiceField but I can\'t seem to call request. Here\'s the code:
The Error:
To get deal with the validation on is_valid()
action, i think this will work
class FooForm(forms.Form):
def __init__(self, foo_choices, *args, **kwargs):
self.base_fields['foo'].choices = foo_choices
super(FooForm, self).__init__(*args, **kwargs)
foo = forms.ChoiceField(choices=(), required=True)
The code above are untested