On Dec 3, 12:22 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> ...
> And here is my view for my signup page -
>
> def signup(request):
>     if request.method == 'POST':
>         form = UserCreationForm(request.POST)
>         extraform =  CustomProfileForm(request.POST)
>         if form.is_valid():
>             form.save()
>             extraform.save()
>             return HttpResponseRedirect("/")
>     else:
>         form = UserCreationForm()
>         extraform =  CustomProfileForm()
>
>     return render_to_response('signup.html', {
>         'form': form,
>         'extraform': extraform
>     })
>
> This view doesnt work because it is not saving 'user' in
> CustomProfileForm.
>
> Ok now the problem I am having is with the foreignkey in the custom
> profile model, and successfully linking that to the User.

Yes. You need to set the user foreign key inside the extraform before
you save it. See the discussion here about ModelForms save() with
commit=False:

http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#the-save-method



--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to