diff options
Diffstat (limited to 'tbc')
-rw-r--r-- | tbc/models.py | 1 | ||||
-rw-r--r-- | tbc/templates/tbc/review-proposal.html | 51 | ||||
-rw-r--r-- | tbc/urls.py | 2 | ||||
-rwxr-xr-x | tbc/views.py | 19 |
4 files changed, 67 insertions, 6 deletions
diff --git a/tbc/models.py b/tbc/models.py index f9e721e..fa36af3 100644 --- a/tbc/models.py +++ b/tbc/models.py @@ -144,5 +144,4 @@ class Proposal(models.Model): class SampleNotebook(models.Model): proposal = models.ForeignKey(Proposal) - notebook = models.FileField(upload_to=get_sample_dir) book_preference = models.CharField(max_length=30, choices=BOOK_PREFERENCE) diff --git a/tbc/templates/tbc/review-proposal.html b/tbc/templates/tbc/review-proposal.html index 2a83e37..d13a4ac 100644 --- a/tbc/templates/tbc/review-proposal.html +++ b/tbc/templates/tbc/review-proposal.html @@ -1,7 +1,7 @@ {% extends 'base.html' %} {% load static %} {% block content %} - <center><h3>Proposals to be reviewed</h3></center> + <center><h3>New Proposals</h3></center> <ol> {% for proposal in proposals %} <li><h5>Propsal from {{ proposal.user.user.first_name }} {{ proposal.user.user.last_name }}</h5></li> @@ -21,13 +21,56 @@ 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> + <a class="btn btn-primary btn-mini" href="{% url 'tbc:ReviewProposals' proposal.id textbook.id %}">Approve & Ask for Samples</a> </div> </div> </div> {% endfor %} - <h5>Status: {{ proposal.status }}</h5> - + <h5><b>Status:</b> You are yet to review this proposal</h5> + <a class="btn btn-primary" href="{% url 'tbc:RejectProposal' proposal.id %}">Reject</a> + </div> + {% endfor %} + </ol> + <hr> + <center><h3>Old Proposals</h3></center> + <ol> + {% for proposal in old_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> + </div> + </div> + </div> + {% endfor %} + <h5> + <b>Status:</b> + {% ifequal proposal.status "samples" %} + Contributor is required to submit sample notebook + {% endifequal %} + {% ifequal proposal.status "book alloted" %} + Book has been alloted. Contributor is required to submmit the codes for entire book. + {% endifequal %} + </h5> + <h5><b>Book Accepted/Alloted:</b> {{ proposal.accepted.title }}</h5> + {% ifequal proposal.status "samples" %} + <h5><a href="#">sample notebook</a><br></h5> + <a class="btn btn-primary" href="{% url 'tbc:DisapproveProposal' proposal.id %}">Disapprove Samples</a> + <a class="btn btn-primary" href="{% url 'tbc:RejectProposal' proposal.id %}">Alot Book</a> + {% endifequal %} </div> {% endfor %} </ol> diff --git a/tbc/urls.py b/tbc/urls.py index 24115c9..ad92e54 100644 --- a/tbc/urls.py +++ b/tbc/urls.py @@ -28,6 +28,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'^disapprove-proposal/(?P<proposal_id>\d+)$', 'tbc.views.DisapproveProposal', name='DisapproveProposal'), + url(r'^reject-proposal/(?P<proposal_id>\d+)$', 'tbc.views.RejectProposal', name='RejectProposal'), 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 3f24074..ae411b8 100755 --- a/tbc/views.py +++ b/tbc/views.py @@ -359,15 +359,32 @@ def ReviewProposals(request, proposal_id=None, textbook_id=None): new_book.contributor = proposal.user new_book.reviewer = Reviewer.objects.get(pk=1) new_book.save() - proposal.status = "book alloted" + proposal.status = "samples" + proposal.accepted = new_book proposal.save() return HttpResponse("Approved") else: new_proposals = Proposal.objects.filter(status="pending") + other_status = ['samples', 'book alloted'] + old_proposals = Proposal.objects.filter(status__in=other_status) context['proposals'] = new_proposals + context['old_proposals'] = old_proposals return render_to_response('tbc/review-proposal.html', context) +def DisapproveProposal(request, proposal_id=None): + if request.method == "POST": + return HttpResponse("Dispproved") + else: + return HttpResponse("no post") + +def RejectProposal(request, proposal_id=None): + if request.method == "POST": + return HttpResponse("Rejected") + else: + return HttpResponse("no post") + + def UpdateBook(request): current_user = request.user user_profile = Profile.objects.get(user=current_user) |