summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhardythe12014-07-15 19:12:34 +0530
committerhardythe12014-07-15 19:12:34 +0530
commite6d89dbf9b75a3e0f3edda8896e8ce586773a2b7 (patch)
tree05e56d85a172ed47fcbc77ffebdb907c7cd6dc2c
parent686b7c2e0805d50729e1e71afdff0796f1273dcc (diff)
downloadPython-TBC-Interface-e6d89dbf9b75a3e0f3edda8896e8ce586773a2b7.tar.gz
Python-TBC-Interface-e6d89dbf9b75a3e0f3edda8896e8ce586773a2b7.tar.bz2
Python-TBC-Interface-e6d89dbf9b75a3e0f3edda8896e8ce586773a2b7.zip
changes on reviewer interface to approve a proposal
-rwxr-xr-xtbc/templates/base.html1
-rw-r--r--tbc/templates/tbc/review-proposal.html36
-rw-r--r--tbc/urls.py2
-rwxr-xr-xtbc/views.py27
4 files changed, 66 insertions, 0 deletions
diff --git a/tbc/templates/base.html b/tbc/templates/base.html
index 09c1c4c..9663c70 100755
--- a/tbc/templates/base.html
+++ b/tbc/templates/base.html
@@ -108,6 +108,7 @@
<a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ reviewer.first_name }} {{ reviewer.last_name }} <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="{% url 'tbc:BookReview' %}">Review Books</a></li>
+ <li><a href="{% url 'tbc:ReviewProposals' %}">Review Proposals</a></li>
<li><a href="{% url 'tbc:UserLogout' %}">Logout</a></li>
</ul>
</li>
diff --git a/tbc/templates/tbc/review-proposal.html b/tbc/templates/tbc/review-proposal.html
new file mode 100644
index 0000000..2a83e37
--- /dev/null
+++ b/tbc/templates/tbc/review-proposal.html
@@ -0,0 +1,36 @@
+{% extends 'base.html' %}
+{% load static %}
+{% block content %}
+ <center><h3>Proposals to be reviewed</h3></center>
+ <ol>
+ {% for proposal in proposals %}
+ <li><h5>Propsal from {{ proposal.user.user.first_name }} {{ proposal.user.user.last_name }}</h5></li>
+ <div class="accordion" id="accordion2">
+ {% for textbook in proposal.textbooks.all %}
+ <div class="accordion-group">
+ <div class="accordion-heading">
+ <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse{{forloop.counter}}">
+ {{ textbook.title }} - Book Preference {{ forloop.counter }}
+ </a>
+ </div>
+ <div id="collapse{{forloop.counter}}" class="accordion-body collapse">
+ <div class="accordion-inner">
+ Author: {{ textbook.author}}<br>
+ Edition: {{ textbook.edition }}<br>
+ Publisher: {{ textbook.publisher_place }}<br>
+ ISBN: {{ textbook.isbn }}<br>
+ Year of Pub.: {{ textbook.year_of_pub }}<br>
+ Category: {{ textbook.category }}<br>
+ <a class="btn btn-primary btn-mini" href="{% url 'tbc:ReviewProposals' proposal.id textbook.id %}">Approve & Alot Book</a>
+ </div>
+ </div>
+ </div>
+ {% endfor %}
+ <h5>Status: {{ proposal.status }}</h5>
+
+ </div>
+ {% endfor %}
+ </ol>
+{% endblock %}
+
+
diff --git a/tbc/urls.py b/tbc/urls.py
index a04b7bb..24115c9 100644
--- a/tbc/urls.py
+++ b/tbc/urls.py
@@ -26,6 +26,8 @@ urlpatterns = patterns('',
url(r'^book-review/$', 'tbc.views.BookReview', name='BookReview'),
+ url(r'^proposal-review/$', 'tbc.views.ReviewProposals', name='ReviewProposals'),
+ url(r'^proposal-review/(?P<proposal_id>\d+)/(?P<textbook_id>\d+)$', 'tbc.views.ReviewProposals', name='ReviewProposals'),
url(r'^book-review/(?P<book_id>\d+)$', 'tbc.views.BookReview', name='BookReview'),
url(r'^approve-book/(?P<book_id>\d+)$', 'tbc.views.ApproveBook', name='ApproveBook'),
url(r'^notify-changes/(?P<book_id>\d+)$', 'tbc.views.NotifyChanges', name='NotifyChanges'),
diff --git a/tbc/views.py b/tbc/views.py
index b178e08..3f24074 100755
--- a/tbc/views.py
+++ b/tbc/views.py
@@ -341,6 +341,33 @@ def SubmitProposal(request):
return HttpResponseRedirect('/?proposal_pending=True')
+def ReviewProposals(request, proposal_id=None, textbook_id=None):
+ context = {}
+ if is_reviewer(request.user):
+ if proposal_id:
+ proposal = Proposal.objects.get(id=proposal_id)
+ accepted_book = TempBook.objects.get(id=textbook_id)
+ new_book = Book()
+ new_book.title = accepted_book.title
+ new_book.author = accepted_book.author
+ new_book.category = accepted_book.category
+ new_book.publisher_place = accepted_book.publisher_place
+ new_book.isbn = accepted_book.isbn
+ new_book.edition = accepted_book.edition
+ new_book.year_of_pub = accepted_book.year_of_pub
+ new_book.no_chapters = accepted_book.no_chapters
+ new_book.contributor = proposal.user
+ new_book.reviewer = Reviewer.objects.get(pk=1)
+ new_book.save()
+ proposal.status = "book alloted"
+ proposal.save()
+ return HttpResponse("Approved")
+ else:
+ new_proposals = Proposal.objects.filter(status="pending")
+ context['proposals'] = new_proposals
+ return render_to_response('tbc/review-proposal.html', context)
+
+
def UpdateBook(request):
current_user = request.user
user_profile = Profile.objects.get(user=current_user)