Monday, November 2, 2015

Re: How do I let forms.models.ModelChoiceField.queryset relate on request.user?

At least what I do in those cases is to add a constructor (__init__) to the form class which takes the user as a parameter, modify the choicefield queryset, and then call the original constructor of the form.

On Sun, Nov 1, 2015 at 3:50 PM, Axel Rau <Axel.Rau@chaos1.de> wrote:
User should see only choices related to him in a ModelChoiceField.
Do I need a fresh form per request?
What would be the best approach?

Thanks, Axel
---
PGP-Key:29E99DD6  ☀ +49 160 9945 7889  ☀ computing @ chaos claudius

--
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/728C3EDF-62BB-4450-920B-BB7376417D9C%40Chaos1.DE.
For more options, visit https://groups.google.com/d/optout.

--
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/CALn3ei0v3POcwmw9s0beYyGXK15ybwDPooPsYDm%3D1_0XvpStpQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment