From 422345a859b85da7bcb6bb55d30ea78cfcd8f65d Mon Sep 17 00:00:00 2001
From: hardythe1
Date: Thu, 29 Jan 2015 14:48:28 +0530
Subject: added categorization for books under progress
---
tbc/templates/tbc/books_under_progress.html | 35 ++++++++++++++++++++++++++++-
tbc/views.py | 12 ++++++++--
2 files changed, 44 insertions(+), 3 deletions(-)
diff --git a/tbc/templates/tbc/books_under_progress.html b/tbc/templates/tbc/books_under_progress.html
index 62a5d5f..ce502e7 100644
--- a/tbc/templates/tbc/books_under_progress.html
+++ b/tbc/templates/tbc/books_under_progress.html
@@ -1,7 +1,37 @@
{% extends "base.html" %}
+{% block script %}
+
+{% endblock %}
+
{% block content %}
-
Books Under Progress
+
+ Books Under Progress
+
+
Sr # |
@@ -66,4 +96,7 @@
Concepts of Thermodynamics by Obert Edward F
Fluid mechanics by Pao, Richard H F
+
{% endblock %}
diff --git a/tbc/views.py b/tbc/views.py
index 2ea148a..5330e6c 100755
--- a/tbc/views.py
+++ b/tbc/views.py
@@ -1133,7 +1133,7 @@ def CompletedBooks(request):
def BooksUnderProgress(request):
context = {}
- images = []
+ context.update(csrf(request))
if request.user.is_anonymous():
context['anonymous'] = True
else:
@@ -1141,7 +1141,15 @@ def BooksUnderProgress(request):
context['reviewer'] = request.user
else:
context['user'] = request.user
- books_under_progress = list(Book.objects.filter(approved=False))
+ if request.method == "POST":
+ category = request.POST['category']
+ if category == "all":
+ books_under_progress = Book.objects.filter(approved=False)
+ else:
+ books_under_progress = Book.objects.filter(category=category,
+ approved=False)
+ else:
+ books_under_progress = Book.objects.filter(approved=False)
context['books_under_progress'] = books_under_progress
return render_to_response('tbc/books_under_progress.html', context)
--
cgit