summaryrefslogtreecommitdiff
path: root/tbc/views.py
diff options
context:
space:
mode:
authorJayaram Pai2013-12-14 23:11:05 +0530
committerJayaram Pai2013-12-14 23:11:05 +0530
commit2ce6bbcb687055a0de41e5a2c3615ee41700b54e (patch)
tree365d0cc37fd3755ad2af66d046b1dde168912add /tbc/views.py
parent8c6a2d21da4d90e54215bc0044325dab2b7ca143 (diff)
parentb9102b56140db8ad81b2b4e3d1dfb99c6bebb3ab (diff)
downloadPython-TBC-Interface-2ce6bbcb687055a0de41e5a2c3615ee41700b54e.tar.gz
Python-TBC-Interface-2ce6bbcb687055a0de41e5a2c3615ee41700b54e.tar.bz2
Python-TBC-Interface-2ce6bbcb687055a0de41e5a2c3615ee41700b54e.zip
fix merge conflict
Diffstat (limited to 'tbc/views.py')
-rw-r--r--tbc/views.py7
1 files changed, 6 insertions, 1 deletions
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)