On Mar 7, 2:42 pm, Naveen Reddy <naveenredd...@gmail.com> wrote: > Why am i getting this error: > ValueError at /user/naveen_admin/ > The view django_bookmarks.bookmarks.views.user_page didn't return an > HttpResponse object. > Request Method: GET > Request URL: http://localhost:8000/user/naveen_admin/ > Exception Type: ValueError > Exception Value: > The view django_bookmarks.bookmarks.views.user_page didn't return an > HttpResponse object. > Exception Location: C:\Python26\lib\site-packages\django\core\handlers > \base.py in get_response, line 109 > Python Executable: C:\Python26\python.exe > Python Version: 2.6.4 > Python Path: ['D:\\django_workspace\\django_bookmarks', 'C:\ > \Python26', 'C:\\WINDOWS\\system32\\python26.zip', 'C:\\Python26\ > \DLLs', 'C:\\Python26\\lib', 'C:\\Python26\\lib\\plat-win', 'C:\ > \Python26\\lib\\lib-tk', 'C:\\Python26\\lib\\site-packages'] > Server time: Sun, 7 Mar 2010 20:07:27 +0530 > > Here's my views code: > from django.http import HttpResponse, Http404 > from django.contrib.auth.models import User > from django.template import Context > from django.template.loader import get_template > > def main_page(request): > template = get_template('main_page.html') > variables = Context({ > 'head_title': 'Django Bookmarks', > 'page_title': 'Welcome to Django Bookmarks', > 'page_body': 'Where you can store and share bookmarks!' > }) > output = template.render(variables) > return HttpResponse(output) > > def user_page(request, username): > try: > user = User.objects.get(username=username) > except: > raise Http404('Requested user not found.') > bookmarks = user.bookmark_set.all() > template = get_template('user_page.html') > variables = Context({ > 'username': username, > 'bookmarks': bookmarks > }) > output = template.render(variables) > return HttpResponse(output) > Please guide me through this. I am absolute beginner to django. Thaks > in advance
Looks like an indentation problem in user_page. The lines after 'raise Http404` should be one indentation level to the left. If you don't understand this, you'll need to follow a beginner's Python tutorial. -- DR. -- 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.