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_profile_form = UserProfileForm(request.POST) if user_form.is_valid() and user_profile_form.is_valid(): user = user_form.save() user_profile = user_profile_form.save(commit=False) user_profile.user = user user_profile.save() return HttpResponseRedirect("/") The statement user_profile = user_profile_form.save(commit=False) is causing the following statement to appear in the MySql log INSERT INTO `courses_userprofile` (`user_id`, `full_name`, `email`, `website`, `timezone`, `bio`) VALUES (39, '', '', '', '', '') And then the statement user_profile.save() is causing another INSERT statement INSERT INTO `courses_userprofile` (`user_id`, `full_name`, `email`, `website`, `timezone`, `bio`) VALUES (39, 'Test User10', 'testus...@ten.com', '', '', '') 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) Am I doing something incorrect? -- Thanks & Regards Parag Shah --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---