> 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
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
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 =
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
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
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
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
7 matches
Mail list logo