Thanks, that worked.

On Jul 10, 1:44 pm, Jonathan Buchanan <jonathan.bucha...@gmail.com>
wrote:
> > I'm making a small app which is kind of like a blog. I have an Entry
> > class which has "ForeignKey(User)" as one of its members. I'm using
> > ModelForm to generate the form and I'm excluding the User ForeignKey
> > because it will just ask for you to pick a user from a drop-down
> > list.
>
> > Where do I tell it that the User ForeignKey should be request.user?
> > I've tried using "initial = {'author'  : request.user}". That
> > generates an "author_id may not be null." Any ideas?
>
> Use the "commit" argument to the ModelForm's save() method to get a
> hold of the resulting model instance without saving it, make any
> changes you want to the instance and then call save() on it yourself.
>
> There's an example of this in the docs:
>
>    http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#the-sav...
>
> Regards,
> Jonathan.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to