Hello list,

I was wondering which would be the best way to handle this situation
with ModelChoiceFields:

I have a form with a ModelChoiceField, the options presented in this
field may change at the view depending on the user, however,
ModelChoiceField requires the queryset to be given as a parameter when
defining the form, which is the best way to handle this? is there a
commonly used way for this? I was thinking on using a Factory method
like this:

def MyForm_builder(queryset):
    class MyForm(forms.Form):
        field = forms.ModelChoiceField(queryset=queryset)
    return MyForm

Any thoughts on this?

Regards,
Carlos Daniel Ruvalcaba Valenzuela

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to