Monday, April 20, 2015

Choices as a callable.. but no parameters?

I am trying to build a form with dynamic choices. e.g., the choices should depend on the user.

https://docs.djangoproject.com/en/1.8/ref/forms/fields/#choicefield

Says choices may now be a callable, and sure enough it is called in `django/forms/fields.py(818)` – but without any parameters.

How can I get access to the current user, view, or any bit of context.

--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4a74be7f-e3cc-4e72-9a15-6a1ca43c9677%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment