summaryrefslogtreecommitdiff
path: root/tbc
diff options
context:
space:
mode:
authorhardythe12015-01-29 14:48:28 +0530
committerhardythe12015-01-29 14:48:28 +0530
commit422345a859b85da7bcb6bb55d30ea78cfcd8f65d (patch)
treef63f778f7589c8f773ec31b157e4f8647e240fce /tbc
parent109e75c2b47e075673187a9f036425815da240a0 (diff)
downloadPython-TBC-Interface-422345a859b85da7bcb6bb55d30ea78cfcd8f65d.tar.gz
Python-TBC-Interface-422345a859b85da7bcb6bb55d30ea78cfcd8f65d.tar.bz2
Python-TBC-Interface-422345a859b85da7bcb6bb55d30ea78cfcd8f65d.zip
added categorization for books under progress
Diffstat (limited to 'tbc')
-rw-r--r--tbc/templates/tbc/books_under_progress.html35
-rwxr-xr-xtbc/views.py12
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 %}
+<script type="text/javascript">
+function submitCategory()
+{
+ document.forms.underprogress.submit();
+}
+</script>
+{% endblock %}
+
{% block content %}
-<center><h2> Books Under Progress </h2></center><br/>
+ <center>
+ <h2> Books Under Progress </h2>
+ <form name="underprogress" action="/books-under-progress/" method=POST enctype="multipart/form-data">
+ {% csrf_token %}
+ <select name="category" id="category" onchange="submitCategory();">
+ <option value="all">All</option>
+ <option value="fluid mechanics">Fluid Mechanics</option>
+ <option value="control systems">Control Theory & Control Systems</option>
+ <option value="chemical engineering">Chemical Engineering</option>
+ <option value="thermodynamics">Thermodynamics</option>
+ <option value="mechanical engineering">Mechanical Engineering</option>
+ <option value="signal processing">Signal Processing</option>
+ <option value="digital communications">Digital Communications</option>
+ <option value="electrical technology">Electrical Technology</option>
+ <option value="maths & science">Mathematics & Pure Science</option>
+ <option value="analog electronics">Analog Electronics</option>
+ <option value="digital electronics">Digital Electronics</option>
+ <option value="computer programming">Computer Programming</option>
+ <option value="others">Others</option>
+ </select>
+ </form>
+ </center><br/>
<table class="table table-bordered table-hover">
<th>Sr #</th>
@@ -66,4 +96,7 @@
<li>Concepts of Thermodynamics by Obert Edward F
<li>Fluid mechanics by Pao, Richard H F
</ol>
+<script>
+ document.getElementById('category').value = "{{ category }}";
+</script>
{% 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)