Is AUTH_PROFILE_MODULE set correctly in settings.py?

On Tue, May 11, 2010 at 6:43 AM, django_jedi <pemaq...@gmail.com> wrote:
> OK, I'm baffled.  I must be missing something right in front of my
> face...
>
> I'm trying to create a form that will allow users to update their
> profiles.  No matter what I try, I get a
>
> "User matching query does not exist."
>
> ...error.  Below is the associated view, and the related model and
> form clases.  Any help would be appreciated.
>
>
>
> VIEW
> ---
> @login_required
> def update_profile(request):
>    try:
>        myprofile = request.user.get_profile()
>    except:
>        up = Profile(user=request.user)
>        up.save()
>        myprofile = request.user.get_profile()
>
>    if request.method == 'POST':
>        form = ProfileUpdateForm(request.POST, request.FILES,
> instance=myprofile)
>        if form.is_valid():
>            form.save()
>    else:
>        form = ProfileUpdateForm(instance=myprofile)
>
>    return render_to_response('profiles/update.html', {'form':form,
> 'profile':myprofile},
>        context_instance = RequestContext(request))
>
> MODEL
> ---
> class Profile(models.Model):
>    # This is the only required field
>    user = models.ForeignKey(User, unique=True)
>    picture = models.ImageField(upload_to='img/profilepics/%Y%m%d/',
> blank=True, null=True)
>    # The rest is completely up to you...
>    favorite_band = models.CharField(max_length=100, blank=True)
>    favorite_cheese = models.CharField(max_length=100, blank=True)
>    lucky_number = models.IntegerField(null=True, blank=True)
>
>
> FORM
> ---
> class ProfileUpdateForm(ModelForm):
>    class Meta:
>        model = Profile
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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