On 13 February 2010 13:46, Anders Eide <eide.and...@gmail.com> wrote: > did a stupid PEBCAK i the urls.py file. Works fine now > > On Feb 13, 1:33 pm, Anders Eide <eide.and...@gmail.com> wrote: >> Why on earth doesn't this user_page view work? Getting "404, No User >> matches the given query." >> >> from django.contrib.auth.models import User >> from django.template import RequestContext >> from django.shortcuts import render_to_response, get_object_or_404 >> >> def user_page(request): >> user = get_object_or_404(User, >> username=request.user.username) >> movies = user.mymovie_set.all() >> variables = RequestContext(request, { >> 'movies': movies, >> }) >> return render_to_response('user_page/user_page.home.view.html', >> variables) >> >> The user is loged in > > -- > 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. > >
user = User.get_object_or_404(User, username=request.user.username) I don't think you need this, request.user is already an instance of User. Try: movies = request.user.mymovie_set.all() -- 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.