Thank you for your reply.
I had previously tried that, but must have had the syntax wrong. Am now
using get_form_kwargs() as it looks nicer.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving ema
If you're using FormMixin then you can also override get_form_kwargs:
def get_form_kwargs(self):
kwargs = super(MyForm, self).get_form_kwargs()
kwargs['creator'] = self.request.user.pk
return kwargs
Then let FormMixin instantiate the form instance itself.
On Wed, May 13, 2015 at 10:1
For anyone else needing this:
In form:
def __init__(self, *args, **kwargs):
self.creator = kwargs.pop('creator', None)
In view:
form = PostForm(request.POST, creator=self.request.user.pk)
--
You received this message because you are subscribed to the Google Groups
"Django users"
3 matches
Mail list logo