From e6d89dbf9b75a3e0f3edda8896e8ce586773a2b7 Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Tue, 15 Jul 2014 19:12:34 +0530 Subject: changes on reviewer interface to approve a proposal --- tbc/templates/base.html | 1 + tbc/templates/tbc/review-proposal.html | 36 ++++++++++++++++++++++++++++++++++ tbc/urls.py | 2 ++ tbc/views.py | 27 +++++++++++++++++++++++++ 4 files changed, 66 insertions(+) create mode 100644 tbc/templates/tbc/review-proposal.html 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 @@ {{ reviewer.first_name }} {{ reviewer.last_name }} 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 %} +

Proposals to be reviewed

+
    + {% for proposal in proposals %} +
  1. Propsal from {{ proposal.user.user.first_name }} {{ proposal.user.user.last_name }}
  2. +
    + {% for textbook in proposal.textbooks.all %} +
    + +
    +
    + Author: {{ textbook.author}}
    + Edition: {{ textbook.edition }}
    + Publisher: {{ textbook.publisher_place }}
    + ISBN: {{ textbook.isbn }}
    + Year of Pub.: {{ textbook.year_of_pub }}
    + Category: {{ textbook.category }}
    + Approve & Alot Book +
    +
    +
    + {% endfor %} +
    Status: {{ proposal.status }}
    + +
    + {% endfor %} +
+{% 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\d+)/(?P\d+)$', 'tbc.views.ReviewProposals', name='ReviewProposals'), url(r'^book-review/(?P\d+)$', 'tbc.views.BookReview', name='BookReview'), url(r'^approve-book/(?P\d+)$', 'tbc.views.ApproveBook', name='ApproveBook'), url(r'^notify-changes/(?P\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) -- cgit