Re: Adding a request.user to a ModelForm instance

2008-01-08 Thread James Bennett
On Jan 8, 2008 11:16 AM, l5x <[EMAIL PROTECTED]> wrote: > This should help you: > http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser No. That's a nasty, ugly, horrible hack that's about fifty times more complicated than what's actually needed to do this. He got it right the first

Re: Adding a request.user to a ModelForm instance

2008-01-08 Thread l5x
On Jan 8, 3:03 am, Car <[EMAIL PROTECTED]> wrote: > Hello > > I have following code; > > class PlaceForm(ModelForm): > class Meta: > model = Place > exclude = ('useradd',) #excluded, because form shouldn't give > a way to set user manually > > Model Place has one foreign key

Re: Adding a request.user to a ModelForm instance

2008-01-08 Thread James Bennett
On Jan 7, 2008 8:03 PM, Car <[EMAIL PROTECTED]> wrote: > Is it possible to add field formerly excluded in ModelForm in view > like in this example below: Yes, but you're not "adding a field". You're simply getting back a model object and then you're 100% done with the ModelForm. What you do with

Re: Adding a request.user to a ModelForm instance

2008-01-07 Thread Brian Rosner
On 2008-01-07 19:03:21 -0700, Car <[EMAIL PROTECTED]> said: > > Hello > > I have following code; > > class PlaceForm(ModelForm): > class Meta: > model = Place > exclude = ('useradd',) #excluded, because form shouldn't give > a way to set user manually > > Model Place has

Re: Adding a request.user to a ModelForm instance

2008-01-07 Thread David Grant
This might be a stupid question, but is request.user set to None? On Jan 7, 2008 6:03 PM, Car <[EMAIL PROTECTED]> wrote: > > Hello > > I have following code; > > class PlaceForm(ModelForm): >class Meta: >model = Place >exclude = ('useradd',) #excluded, because form shouldn't

Re: Adding a request.user to a ModelForm instance

2008-01-07 Thread Car
I've tried different aproach with overriding default save method - hacking shourtcuts wasn't the best idea. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Adding a request.user to a ModelForm instance

2008-01-07 Thread Car
Hello I have following code; class PlaceForm(ModelForm): class Meta: model = Place exclude = ('useradd',) #excluded, because form shouldn't give a way to set user manually Model Place has one foreign key to django User model (useradd) Is it possible to add field formerly