On Feb 15, 2:29 pm, zeev <[EMAIL PROTECTED]> wrote:
> Hello
>
> I am new in Django
>
> This is the code Iwrote
>
> u = User.objects.get(username = "zeev")
> form = UserForm(instance = u)
> p = u.userprofile_set.all()
> form1 = UserProfileForm(instance = p)
This doesn't work because p is a QuerySet of multiple objects instead
of a single instance.
Try one of these:
p = u.get_profile()
Or
p = u.userprofile_set.all()[0]
See the following to learn why u.get_profile() works:
http://www.djangobook.com/en/beta/chapter12/#cn226
-Rajesh D
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---