From 8e01ba34eef9ad1b59effbd4edaac43f327c010d Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Sat, 14 Dec 2013 13:14:09 +0530 Subject: changing the links to tbc-python.fossee.in --- tbc/views.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tbc/views.py') diff --git a/tbc/views.py b/tbc/views.py index 2556e1f..0a5dbf5 100644 --- a/tbc/views.py +++ b/tbc/views.py @@ -51,6 +51,8 @@ def Home(request): context['logout'] = True if 'update_book' in request.GET: context['update_book'] = True + if 'not_found' in request.GET: + context['not_found'] = True books = Book.objects.filter(approved=True)[0:6] for book in books: images.append(ScreenShots.objects.filter(book=book)[0]) @@ -169,7 +171,10 @@ def SubmitBook(request): def UpdateBook(request): current_user = request.user user_profile = Profile.objects.get(user=current_user) - book_to_update = Book.objects.get(contributor=user_profile, approved=False) + try: + book_to_update = Book.objects.get(contributor=user_profile, approved=False) or None + except: + return HttpResponseRedirect("/?not_found=True") title = book_to_update.title chapters = Chapters.objects.filter(book=book_to_update) screenshots = ScreenShots.objects.filter(book=book_to_update) -- cgit