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

2015-11-18 Thread Axel Rau
> Am 18.11.2015 um 15:28 schrieb 'Tom Evans' via Django users > : > > modelform_factory takes many arguments, one of which is for the base > form class to use. You can provide a different base class from the > default ModelForm, make sure to derive the new base

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

2015-11-18 Thread 'Tom Evans' via Django users
On Mon, Nov 16, 2015 at 5:38 PM, Axel Rau wrote: > > Any idea how to add __init__() to a form class, created by modelform_factory > () ? > > Axel > modelform_factory takes many arguments, one of which is for the base form class to use. You can provide a different base class

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

2015-11-17 Thread Axel Rau
Instead off writing an __init__ for the form class, I ended up with this get_form() in my view class: def get_form(self, form_class=None): form = self.get_form_class() pk = self.request.user.pk self.object = Account.objects.get(pk=pk) form_instance =

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

2015-11-16 Thread Axel Rau
Any idea how to add __init__() to a form class, created by modelform_factory () ? Axel Am 02.11.2015 um 13:50 schrieb Vijay Khemlani : > 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

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

2015-11-04 Thread Axel Rau
Thanks, I will try this, Axel > Am 02.11.2015 um 13:50 schrieb Vijay Khemlani : > > 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

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

2015-11-02 Thread Vijay Khemlani
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 wrote: > User should see

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

2015-11-01 Thread Axel Rau
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