Saturday, August 19, 2017

Re: A lot of Problems with Migrating (conceptual)


# later in forms.py
category = forms.TypedChoiceField(required=False, choices=get_categories)

This has a similar effect to the ModelChoiceField, with the query only running when the form is instantiated, but gives you the flexibility to use whatever logic you'd like to come up with the choices for the field.

Forgot the doc link:


-James

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciVq8Dsxz2uw6NOJJcnAniDuiEY5qU6NKKDAYmOhWk%3DMVw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment