summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhardythe12014-02-18 17:41:38 +0530
committerhardythe12014-02-18 17:41:38 +0530
commitb1277600644ff0d0a561770bd6158e17747a0a0b (patch)
treedef3c9aac344da2c057ae897e290bf4ac736b7ce
parent547bc2ca4f9296262c03be5220c25dbca11f463b (diff)
downloadPython-TBC-Interface-b1277600644ff0d0a561770bd6158e17747a0a0b.tar.gz
Python-TBC-Interface-b1277600644ff0d0a561770bd6158e17747a0a0b.tar.bz2
Python-TBC-Interface-b1277600644ff0d0a561770bd6158e17747a0a0b.zip
minor change in browsebooks
-rw-r--r--tbc/views.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/tbc/views.py b/tbc/views.py
index 762f0bd..a689930 100644
--- a/tbc/views.py
+++ b/tbc/views.py
@@ -474,6 +474,9 @@ def NotifyChanges(request, book_id=None):
def BrowseBooks(request):
context = {}
category = None
+ images = []
+ book_images = []
+ books = []
if request.user.is_anonymous():
context['anonymous'] = True
else:
@@ -481,10 +484,12 @@ def BrowseBooks(request):
context['reviewer'] = request.user
else:
context['user'] = request.user
- images = []
if request.method == 'POST':
category = request.POST['category']
- books = Book.objects.filter(category=category)
+ if category == "all":
+ books = Book.objects.all()
+ else:
+ books = Book.objects.filter(category=category)
for book in books:
images.append(ScreenShots.objects.filter(book=book)[0])
else:
@@ -492,7 +497,6 @@ def BrowseBooks(request):
for book in books:
images.append(ScreenShots.objects.filter(book=book)[0])
context.update(csrf(request))
- book_images = []
for i in range(len(books)):
obj = {'book':books[i], 'image':images[i]}
book_images.append(obj)