Re: Saving ModelForm with commit=False seems to be generating an INSERT in the database

2009-09-22 Thread Parag Shah
Thanks, you both are right. user_form.save() is causing the INSERT of the related UserProfile object. The User object in question here is django.contrib.auth's User object. It knows about the UserProfile model object from the following line in settings.py AUTH_PROFILE_MODULE = 'courses.userprofi

Re: Saving ModelForm with commit=False seems to be generating an INSERT in the database

2009-09-20 Thread Andrew Mckay
> Why is an INSERT statement being generated even though I have > commit=False? The two inserts are causing an Exception which prevent > the actual user data from being saved (a row in the > courses_userprofile table does get created, but with all columns > except the id being blank) Its odd that

Re: Saving ModelForm with commit=False seems to be generating an INSERT in the database

2009-09-20 Thread Daniel Roseman
On Sep 20, 6:54 pm, Parag Shah wrote: > Hello, > > I have a UserProfile Model object which has the > django.contrib.auth.models.User as it's ForeignKey. > > There is a register function in the view module, which goes like this: > > def register(request): >   if request.method == 'POST': >       u

Saving ModelForm with commit=False seems to be generating an INSERT in the database

2009-09-20 Thread Parag Shah
Hello, I have a UserProfile Model object which has the django.contrib.auth.models.User as it's ForeignKey. There is a register function in the view module, which goes like this: def register(request): if request.method == 'POST': user_form = UserCreationForm(request.POST) user_pro