I always use my own forms (no ModelForms), because there is better control of
the form (validation, save function).
But definetely more of code will help (models, whole view function).
We will work it out ;-)

R.


erdmaennchen wrote:
> 
> 
> After the next night of coding, reading through documentation and
> searching through the userlist and google I'm now at the following
> point:
> I'm using two forms, one for the auth.User data (model=User) and one
> for the additional profile data (model=CustomProfile). Both are
> extending ModelForm and I managed to get them into one template.
> Everything just great with that and I think I will stay with that
> approach. Sadly I ran into new problems. I know that ModelForms which
> only want to use certain fields have to provide the rest of the data
> too. So I tried the following for getting the data into the User form
> that I'm not changing.
> 
> The form seems to forget my instance data. If I try to POST this, the
> form is always invalid because required fields like 'username' are
> suddenly unset. When I visit the site the first time (via GET) the
> data from the user is available. After the first POST the data is just
> gone. The request.user is set (and I'm using the correct Context
> Processor for it) and contains all the needed data. I'm quite sure
> that there is some minor bug in my code. But it's driving me insane
> because I'm working since I'd say 8 hours on this whole thing (nobody
> said learning is easy). If you need more explicite code (or more code
> in general) to find my mistake, please let me know. I'd really love to
> get that final piece in the registration / authentication / profiles
> chain working. Long story short, here's the code snippet:
> 
> (I left out and renamed some code to point out the things which I
> think are the problem (for example the whole second form handling
> etc).)
> [SNIP]
> if request.method == 'POST':
> 
>     formUser = FormUser(data=request.POST, files=request.FILES,
> instance=request.User)
> 
>     if formUser.is_valid():
>         user_obj = formUser.save()
>         return HttpResponseRedirect(reverse('some_site'))
>     else:
>         formUser = FormUser(instance=request.user)
> 
>     return render_to_response("some/testing.html",
>         {'formUser':formUser,
>         'formProfile':formProfile},
>         context_instance=RequestContext(request))
> [SNIP]
> 
> Best regards and once again: Thanks in advance - maybe you are going
> to make my day :-).
> 
> Alex
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/General-question%3A-Django-Profiles%2C-auth.User-and-%22merging%22-both-data-tp20458575p20475992.html
Sent from the django-users mailing list archive at Nabble.com.


--~--~---------~--~----~------------~-------~--~----~
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