I tried that before your answer arrived and it worked like a charm. I
just excluded the author field from the form and kept everything else
the same. It works perfectly, as the user was already passed to the
author field in the view. A logged in user can now automatically post
a story now through the form and it appears under their username.

So simple. I asked elsewhere and received extremely convoluted answers
that caused more confusion and chaos rather than comfort.

Thank you for reaffirming. Although, I didn't have to override the
form (new_story.save()) to make it work. I should probably just leave
it alone and enjoy the functionality!

On Feb 24, 11:02 pm, Shawn Milochik <sh...@milochik.com> wrote:
> Read the Django docs about ModelForms, then use the 'exclude' kwarg to
> exclude the author from your ModelForm.
>
> Then, use request.user to get the appropriate user in your view and pass
> that to the form save(), which you must override to accept the extra
> argument, and use that user in the save() method to set the author directly.

-- 
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