tags:

views:

102

answers:

1

Is there any documentation on this? I couldn't dig any up.

I have a custom ModelForm for creating articles. Whenever I use this form, I pass in an article instance so that I can automatically set the author:

    article = Article(author=req.user)
    form = ArticleForm(req.POST, instance=article)

How do I access this instance/article variable from inside form.save()?
Is there anything else I need to be aware of when writing this method? Or does it just need to return an article and that's pretty much it?

+3  A: 

I guess the answer I'm looking for is:

article = super(ArticleForm, self).save(commit=False)
Mark