Hello all,
I have a dynamic form as follows:
class myForm(forms.Form):
Question = forms.ModelMultipleChoiceField(queryset=Model.objects.none(),
widget=forms.RadioSelect())
def __init__(self, request, *args, **kwargs):
super(myForm, self).__init__(*args, **kwargs)
self.fields['Question'].choices =
Model.objects.filter(**request.session['filter_dict']).values_list('city',
'city').distinct()
In views.py I have
def myAnswer(request):
Answer = myForm(request.GET or None)
if Answer.is_valid():
...........................................................
...........................................................
I am getting the "'QueryDict' object has no attribute 'session'" error, and
I believe it is because of the "Ans = myForm(request.GET or None)" line.
Could anyone please let me know how to fix it ?
Many thanks!
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/Lrlt6JCAaAcJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.