On Feb 26, 3:12 pm, "uno...@gmail.com" <uno...@gmail.com> wrote:
> I have the following model form:
>
> class EditProfileForm(ModelForm):
>
>     class Meta:
>         model = UserProfile
>         exclude = ('user',)
>
> The corresponding model is:
>
> class UserProfile(models.Model):
>
>     user = models.ForeignKey(User)
>     firstname = models.CharField(max_length=50,blank=True)
>     lastname = models.CharField(max_length=50,blank=True)
>     blog = models.URLField(blank=True)
>     location = models.CharField(max_length=50,blank=True)
>     karma = models.IntegerField(editable=False,default="0")
>
> and the view is:
>
> def editprofile(request):
>
>     user = request.user
>     profile = UserProfile.objects.get_or_create(user=user)
>
>     if request.method == "POST":
>
>         form = EditProfileForm(request.POST,instance=profile)
>         if form.is_valid():
>             profile = form.save()
>             return HttpResponseRedirect("/myprofile/")
>     else:
>         form = EditProfileForm(instance=profile)
>
>     return render_to_response("editprofile.html",{"form":form},
>                               context_instance=RequestContext
> (request))
>
> I keep getting the following error:
>
> AttributeError: 'tuple' object has no attribute '_meta'
>
> on the line:  form = EditProfileForm(instance=profile)
>
> any ideas what's wrong here ?

Could you please post more details.
a) Error is in forms.py or views.py or models.py ?

b) Can you figure out which lines are giving the error ?

You could use http://dpaste.com/ to paste the error details and send
us the link. that would save long email with error messages.

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

Reply via email to