I know. Just a typo in this post. Thanks for trying to help anyway :)

the error was in the urls.py


/user/<username>/
/user/page/

When loading /user/page/ /user/<username/ view was triggered



On Feb 13, 1:50 pm, rebus_ <[email protected]> wrote:
> On 13 February 2010 13:46, Anders Eide <[email protected]> wrote:
>
>
>
> > did a stupid PEBCAK i the urls.py file. Works fine now
>
> > On Feb 13, 1:33 pm, Anders Eide <[email protected]> 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 [email protected].
> > To unsubscribe from this group, send email to 
> > [email protected].
> > For more options, visit this group 
> > athttp://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 [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.

Reply via email to