Re: simple form question

2008-08-23 Thread nonight
have a study. On 8月21日, 下午6时56分, patrickk <[EMAIL PROTECTED]> wrote: > you could use modelforms, > seehttp://www.djangoproject.com/documentation/modelforms/ > > or without modelforms: > > class MyForm(forms.Form): > > def __init__(self, user, *args, **kwargs): > self.user = user >

Re: simple form question

2008-08-21 Thread patrickk
you could use modelforms, see http://www.djangoproject.com/documentation/modelforms/ or without modelforms: class MyForm(forms.Form): def __init__(self, user, *args, **kwargs): self.user = user super(MyForm, self).__init__(*args, **kwargs) ... define your fields

Re: simple form question

2008-08-21 Thread Genis Pujol Hamelink
Thanks for your reply, save() got an unexpected keyword argument 'commit' as I didn't define commit in my save function... where did u get this commit=False from? Grtz, G. On Thu, Aug 21, 2008 at 12:41 PM, patrickk <[EMAIL PROTECTED]> wrote: > > try this: > form.save(commit=False) >

Re: simple form question

2008-08-21 Thread patrickk
try this: form.save(commit=False) form.autor = request.user form.save() On Aug 21, 12:24 pm, "Genis Pujol Hamelink" <[EMAIL PROTECTED]> wrote: > Hello, > > I'm trying to pass a the id of the user logged in to a form field, but it > doesn't seem to work... any ideas / suggestions? > > Thanks in

simple form question

2008-08-21 Thread Genis Pujol Hamelink
Hello, I'm trying to pass a the id of the user logged in to a form field, but it doesn't seem to work... any ideas / suggestions? Thanks in advance :) Here are the view, model and form objects: View: def punts_form3(request): if request.method == 'POST': form =