diff options
-rw-r--r-- | website/templates/abstract_details.html | 2 | ||||
-rw-r--r-- | website/templates/list_abstracts.html | 7 | ||||
-rw-r--r-- | website/templates/list_abstracts_anonymous.html | 19 | ||||
-rw-r--r-- | website/templates/not_allowed.html | 11 | ||||
-rw-r--r-- | website/views.py | 56 |
5 files changed, 69 insertions, 26 deletions
diff --git a/website/templates/abstract_details.html b/website/templates/abstract_details.html index 07f5f75..5323883 100644 --- a/website/templates/abstract_details.html +++ b/website/templates/abstract_details.html @@ -7,10 +7,8 @@ {% endblock %} {% block userblock %} -{% if current_user != "anonymous" %} <li><a href="#"> {{ current_user }}</a></li> <li><a href="/2013/accounts/logout">Logout</a></li> -{% endif %} {% endblock %} diff --git a/website/templates/list_abstracts.html b/website/templates/list_abstracts.html index ebf6d54..2d75893 100644 --- a/website/templates/list_abstracts.html +++ b/website/templates/list_abstracts.html @@ -5,6 +5,12 @@ <li><a href="{% url 'website:list-abstracts'%}">List of Abstracts</a></li> {% endblock %} +{% block userblock %} +<li><a href="#"> {{ user }}</a></li> +<li><a href="/2013/accounts/logout">Logout</a></li> +{% endblock %} + + {% block content %} <center><h4>List of Abstracts</h4></center> @@ -15,5 +21,4 @@ <tr><td><a href="{% url 'website:abstract-details' paper.id %}">{{ paper.title }}</a></td><td>{{ paper.user.first_name }} {{ paper.user.last_name }}</td></tr> {% endfor %} </table> -Note: These are not selected abstracts. Our committee is reviewing the abstracts & list of same will be published soon. {% endblock %} diff --git a/website/templates/list_abstracts_anonymous.html b/website/templates/list_abstracts_anonymous.html new file mode 100644 index 0000000..bce3db3 --- /dev/null +++ b/website/templates/list_abstracts_anonymous.html @@ -0,0 +1,19 @@ +{% extends 'page.html'%} + +{% block breadcrumbs %} +<li><a href="{% url 'website:invited-speakers'%}">Invited Speakers</a></li> +<li><a href="{% url 'website:list-abstracts'%}">List of Abstracts</a></li> +{% endblock %} + + +{% block content %} +<center><h4>List of Abstracts</h4></center> +<table align="center"> +<th>Title +<th>Speaker +{% for paper in papers %} + <tr><td>{{ paper.title }}</td><td>{{ paper.user.first_name }} {{ paper.user.last_name }}</td></tr> +{% endfor %} +</table> +Note: These are not selected abstracts. Our committee is reviewing the abstracts & list of same will be published soon. +{% endblock %} diff --git a/website/templates/not_allowed.html b/website/templates/not_allowed.html new file mode 100644 index 0000000..c5e8e4d --- /dev/null +++ b/website/templates/not_allowed.html @@ -0,0 +1,11 @@ +{% extends 'page.html'%} + +{% block breadcrumbs %} +<li><a href="{% url 'website:invited-speakers'%}">Invited Speakers</a></li> +<li><a href="{% url 'website:list-abstracts'%}">List of Abstracts</a></li> +{% endblock %} + + +{% block content %} +Oops, Sorry ! You are not allowed to view this page. +{% endblock %} diff --git a/website/views.py b/website/views.py index 130556a..cc225bd 100644 --- a/website/views.py +++ b/website/views.py @@ -42,38 +42,48 @@ def invited_speakers_page(request): return render_to_response('invited_speakers.html') def list_of_abstracts(request): + user = request.user context = {} + reviewers = ['jaidevd', 'prabhu', 'jarrod'] papers = Paper.objects.all() - context['papers'] = papers - return render_to_response('list_abstracts.html', context) + if user.username not in reviewers: + context['papers'] = papers + return render_to_response('list_abstracts_anonymous.html', context) + else: + context['papers'] = papers + context['user'] = user + 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 + reviewers = ['jaidevd', 'prabhu', 'jarrod'] if user.username in reviewers: context['reviewer'] = True - context['paper'] = paper - 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', '<br>') - new_comment.save() - return HttpResponseRedirect('/2013/abstract-details/'+paper_id, 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 + context['paper'] = paper + 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', '<br>') + new_comment.save() + return HttpResponseRedirect('/2013/abstract-details/'+paper_id, context) + else: + return render_to_response('abstract_details.html', context) else: - return render_to_response('abstract_details.html', context) + return render_to_response('not_allowed.html', context) + def accepted_abstracts_page(request): |