Re: inputting a request.user into a model on the backend

2010-02-08 Thread goome
My previous mex got with wrong identation: the last 4 lines need to start at the same level: if request.method == 'POST': form = GoalForm(request.POST) if form.is_valid(): goal=form.save(commit=False) goal.user=request.user goal.save() form.save_m2m() -- You received this messag

Re: inputting a request.user into a model on the backend

2010-02-08 Thread goome
On 7 Feb, 22:26, kamilski81 wrote: > I am trying to set a user on a model, on the back-end. > >         u = request.user >         g = Goal() >         g.user = u >         form = GoalForm(request.POST, g) > > I am getting the following error: > goal.user_id may not be NULL hello you can try wit

Re: inputting a request.user into a model on the backend

2010-02-07 Thread Daniel Roseman
On Feb 7, 9:26 pm, kamilski81 wrote: > I am trying to set a user on a model, on the back-end. > >         u = request.user >         g = Goal() >         g.user = u >         form = GoalForm(request.POST, g) > > I am getting the following error: > goal.user_id may not be NULL What was wrong with