On Wednesday 22 October 2014 10:50:51 Marc Tamlyn wrote:
>
> As for a work around, using a ChoiceField directly shouldn't be
> particularly difficult in this case. ModelChoiceField has some nice
> features but it is limited.
>
Using a ChoiceField as a substitute for ModelChoiceField isn't hard, but one
should be aware of the pitfalls. The obvious nicety handled by
ModelChoiceField is the transformation from ids back to objects; the less
obvious one is that a ModelChoiceField runs the query anew for every form;
your ChoiceField cannot be initialized by a query in its definition, and needs
to have its choices set in the form's __init__().
HTH,
Shai.
--
You received this message because you are subscribed to the Google Groups
"Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/201410221215.32597.shai%40platonix.com.
For more options, visit https://groups.google.com/d/optout.