From fffd83ebcdef2853006af6aaf29771dea58b44b0 Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Wed, 27 Nov 2013 16:08:58 +0530 Subject: changes for reviewers to comment on abstracts --- scipy/forms.py | 20 -------------------- website/admin.py | 6 +++++- website/models.py | 6 ++++++ website/static/css/main.css | 6 ++++++ website/templates/abstract_details.html | 30 ++++++++++++++++++++++++++++-- website/templates/invited_speakers.html | 8 +++++++- website/templates/list_abstracts.html | 1 + website/views.py | 29 +++++++++++++++++++++++++---- 8 files changed, 78 insertions(+), 28 deletions(-) diff --git a/scipy/forms.py b/scipy/forms.py index 2c13850..b3c60f6 100644 --- a/scipy/forms.py +++ b/scipy/forms.py @@ -56,23 +56,3 @@ class DocumentUploadForm(forms.ModelForm): elif content_size > 5242880: raise forms.ValidationError('File size exceeds 5MB') return attachments - - - - - - - - - - - - - - - - - - - - diff --git a/website/admin.py b/website/admin.py index 8f02a21..1f2fa58 100644 --- a/website/admin.py +++ b/website/admin.py @@ -1,9 +1,13 @@ from django.contrib import admin -from website.models import Paper +from website.models import Paper, Comment class PaperAdmin(admin.ModelAdmin): list_display = ('user', 'verified') +class CommentAdmin(admin.ModelAdmin): + list_display = ('comment', 'comment_by') + admin.site.register(Paper, PaperAdmin) +admin.site.register(Comment, CommentAdmin) diff --git a/website/models.py b/website/models.py index 158c073..9784776 100644 --- a/website/models.py +++ b/website/models.py @@ -17,3 +17,9 @@ class Paper(models.Model): links = models.CharField(max_length=128) attachments = models.FileField(upload_to=get_document_dir) verified = models.NullBooleanField() + +class Comment(models.Model): + paper = models.ForeignKey(Paper) + comment_by = models.ForeignKey(User) + comment = models.CharField(max_length=500) + diff --git a/website/static/css/main.css b/website/static/css/main.css index 88812e6..356245f 100644 --- a/website/static/css/main.css +++ b/website/static/css/main.css @@ -208,3 +208,9 @@ padding: 10px; text-align: justify; } +.comment { + margin: 0 0 15px 0; + padding: 10px 10px; + background: #f5f5f5; + border-left: 2px solid #86c543; +} diff --git a/website/templates/abstract_details.html b/website/templates/abstract_details.html index 3abf02e..07f5f75 100644 --- a/website/templates/abstract_details.html +++ b/website/templates/abstract_details.html @@ -6,17 +6,43 @@
  • List of Abstracts
  • {% endblock %} +{% block userblock %} +{% if current_user != "anonymous" %} +
  • {{ current_user }}
  • +
  • Logout
  • +{% endif %} +{% endblock %} + + {% block content %} -

    {{ paper.title }}

    +

    {{ paper.title }}

    {{ paper.user.first_name }} {{ paper.user.last_name }}

    {{ paper.bio }}

    +

    Abstract:

    {{ paper.abstract }}

    Affiliation: {{ paper.affiliation }}

    Links: {{ paper.links }}

    -

    Attachment

    +{% if attachment%} +

    View Attachment

    +{% endif %} +
    +{% if reviewer %} +
    Comments
    + {% for comment in comments %} +
    + {{ comment.comment_by.first_name }} {{ comment.comment_by.last_name }} +

    {{ comment.comment|safe }}

    +
    + {% endfor %} +
    + {% csrf_token %} + + +
    +{% endif %} {% endblock %} diff --git a/website/templates/invited_speakers.html b/website/templates/invited_speakers.html index d9b56bf..fc5f773 100644 --- a/website/templates/invited_speakers.html +++ b/website/templates/invited_speakers.html @@ -1,5 +1,11 @@ {% extends 'page.html'%} {% load static %} + +{% block breadcrumbs %} +
  • Invited Speakers
  • +
  • List of Abstracts
  • +{% endblock %} + {% block content %}

    Invited Speakers

    @@ -29,4 +35,4 @@
    -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/website/templates/list_abstracts.html b/website/templates/list_abstracts.html index 4389d2d..ebf6d54 100644 --- a/website/templates/list_abstracts.html +++ b/website/templates/list_abstracts.html @@ -15,4 +15,5 @@ {{ paper.title }}{{ paper.user.first_name }} {{ paper.user.last_name }} {% endfor %} +Note: These are not selected abstracts. Our committee is reviewing the abstracts & list of same will be published soon. {% endblock %} diff --git a/website/views.py b/website/views.py index 747f9d4..130556a 100644 --- a/website/views.py +++ b/website/views.py @@ -1,6 +1,7 @@ from django.http import HttpResponse, HttpResponseRedirect +from django.core.context_processors import csrf from django.shortcuts import render_to_response -from models import Paper +from models import * # Home section def home_page(request): @@ -47,12 +48,32 @@ def list_of_abstracts(request): return render_to_response('list_abstracts.html', context) def abstract_details(request, paper_id=None): + user = request.user + reviewers = ['jaidevd', 'prabhu', 'jarrod'] context = {} paper = Paper.objects.get(id=paper_id) + comments = Comment.objects.filter(paper=paper) + if(len(str(paper.attachments))<=0): + attachment = False + else: + attachment = True + if user.username in reviewers: + context['reviewer'] = True context['paper'] = paper - if(len(paper.abstract)<=0): - return HttpResponse(paper.abstract) - return render_to_response('abstract_details.html', context) + context['comments'] = comments + context['attachment'] = attachment + context['current_user'] = user + context.update(csrf(request)) + if request.method == 'POST': + user_comment = request.POST['comment'] + new_comment = Comment() + new_comment.paper = paper + new_comment.comment_by = user + new_comment.comment = user_comment.replace('\n', '
    ') + new_comment.save() + return HttpResponseRedirect('/2013/abstract-details/'+paper_id, context) + else: + return render_to_response('abstract_details.html', context) def accepted_abstracts_page(request): -- cgit