Re: Saving Django User in Form

2012-02-25 Thread DF
Thanks for the advice. I want to make sure it's secure. What's the best way to override the save I posted in the code above without causing issues? On Feb 25, 2:10 am, Bernhard Schandl wrote: > Hi, > > > I tried that before your answer arrived and it worked like a

Re: Saving Django User in Form

2012-02-25 Thread Bernhard Schandl
Hi, > 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

Re: Saving Django User in Form

2012-02-24 Thread DF
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

Re: Saving Django User in Form

2012-02-24 Thread Shawn Milochik
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()

Saving Django User in Form

2012-02-24 Thread DF
I'm currently working on my first Django app, which allows registered users to submit content through a basic form. It works thus far with one caveat: when the form is displayed, the user ("Author") is presented with a drop-down list of all users instead of automatically populating that field