From 8f0e4cf6a17588a5d370b82de9d2b2fbdeca0ea7 Mon Sep 17 00:00:00 2001 From: florapdx Date: Wed, 24 Apr 2013 13:47:42 -0700 Subject: [PATCH 01/12] change behavior so that admin can add sponsor logos/text in-dashboard --- symposion/sponsorship/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/symposion/sponsorship/views.py b/symposion/sponsorship/views.py index 99d37b1b..c855e92f 100644 --- a/symposion/sponsorship/views.py +++ b/symposion/sponsorship/views.py @@ -35,7 +35,9 @@ def sponsor_add(request): sponsor = form.save(commit=False) sponsor.active = True sponsor.save() - return redirect("dashboard") + return redirect("sponsor_detail", pk=sponsor.pk) + # changing default behavior (below) so that admins can add text/logos/files in-dashboard + # return redirect("dashboard") else: form = SponsorApplicationForm(user=request.user) From 9ab34b8ea5a706fe0e3c16f32fad5adfded048ba Mon Sep 17 00:00:00 2001 From: florapdx Date: Wed, 24 Apr 2013 16:08:31 -0700 Subject: [PATCH 02/12] deleted my inline comment --- symposion/sponsorship/views.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/symposion/sponsorship/views.py b/symposion/sponsorship/views.py index c855e92f..22b4f243 100644 --- a/symposion/sponsorship/views.py +++ b/symposion/sponsorship/views.py @@ -36,8 +36,6 @@ def sponsor_add(request): sponsor.active = True sponsor.save() return redirect("sponsor_detail", pk=sponsor.pk) - # changing default behavior (below) so that admins can add text/logos/files in-dashboard - # return redirect("dashboard") else: form = SponsorApplicationForm(user=request.user) From db7f8fac5d43fc501d4df4cb88899991ddf509b9 Mon Sep 17 00:00:00 2001 From: florapdx Date: Thu, 25 Apr 2013 15:37:38 -0700 Subject: [PATCH 03/12] added user_not_reviewed to templatetags --- symposion/reviews/templatetags/review_tags.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/symposion/reviews/templatetags/review_tags.py b/symposion/reviews/templatetags/review_tags.py index 33471b33..33879d53 100644 --- a/symposion/reviews/templatetags/review_tags.py +++ b/symposion/reviews/templatetags/review_tags.py @@ -1,6 +1,7 @@ from django import template from symposion.reviews.models import Review, ReviewAssignment +from symposion.proposals.models import ProposalBase register = template.Library() @@ -12,6 +13,12 @@ def user_reviews(context): reviews = Review.objects.filter(user=request.user) return reviews +@register.assignment_tag(takes_context=True) +def user_not_reviewed(context): + request = context["request"] + already_reviewed = [r.proposal_id for r in Review.objects.filter(user=request.user)] + yet_to_review = ProposalBase.objects.exclude(id__in=[p.id for p in ProposalBase.objects.filter(id__in=already_reviewed)]).exclude(speaker=request.user) + return yet_to_review @register.assignment_tag(takes_context=True) def review_assignments(context): From f1b37c98338705c4316d64970fac6ca5c1db9be6 Mon Sep 17 00:00:00 2001 From: florapdx Date: Thu, 25 Apr 2013 15:39:15 -0700 Subject: [PATCH 04/12] add markup for listing proposals user has yet to review --- symposion/templates/dashboard.html | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/symposion/templates/dashboard.html b/symposion/templates/dashboard.html index edac0060..23b85cbc 100644 --- a/symposion/templates/dashboard.html +++ b/symposion/templates/dashboard.html @@ -132,6 +132,7 @@

{% trans "Reviews" %}

{% user_reviews as user_reviews %} + {% user_not_reviewed as user_not_reviewed %}

Review Sections

@@ -162,6 +163,26 @@ {% endfor %} + +

Proposals you have yet to review

+ + + + + + + {% for proposal in user_not_reviewed %} + + + + + {% endfor %} + +
#Speaker / Title
{{ proposal.number }} + {{ proposal.speaker }} +
+ {{ proposal.title }} +
{% comment %}

My Assignments

From 40b04240d4ae30eeb41f8a9ced7fee9fc6d2529f Mon Sep 17 00:00:00 2001 From: florapdx Date: Mon, 29 Apr 2013 14:00:58 -0700 Subject: [PATCH 05/12] added Meta class ordering by name to order speaker lists and dropdowns --- symposion/speakers/models.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/symposion/speakers/models.py b/symposion/speakers/models.py index 0dd503ec..c86c9aa2 100644 --- a/symposion/speakers/models.py +++ b/symposion/speakers/models.py @@ -26,12 +26,16 @@ class Speaker(models.Model): default = datetime.datetime.now, editable = False ) + + class Meta: + ordering = ['name'] def __unicode__(self): if self.user: return self.name else: return "?" + def get_absolute_url(self): return reverse("speaker_edit") From 0ad89365e9b320b80deaeb1173a9b9c99f9bd99b Mon Sep 17 00:00:00 2001 From: florapdx Date: Mon, 29 Apr 2013 14:02:39 -0700 Subject: [PATCH 06/12] added code to review_section view to sort by all, reviewed, and not reviewed --- symposion/reviews/views.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/symposion/reviews/views.py b/symposion/reviews/views.py index 78258771..56ad0e87 100644 --- a/symposion/reviews/views.py +++ b/symposion/reviews/views.py @@ -62,8 +62,10 @@ def proposals_generator(request, queryset, user_pk=None, check_speaker=True): yield obj +# Returns a list of all proposals, proposals reviewed by the user, or the proposals the user has yet to review +# depending on the link user clicks in dashboard @login_required -def review_section(request, section_slug, assigned=False): +def review_section(request, section_slug, assigned=False, reviewed='all'): if not request.user.has_perm("reviews.can_review_%s" % section_slug): return access_not_permitted(request) @@ -74,19 +76,28 @@ def review_section(request, section_slug, assigned=False): if assigned: assignments = ReviewAssignment.objects.filter(user=request.user).values_list("proposal__id") queryset = queryset.filter(id__in=assignments) - - queryset = queryset.select_related("result").select_subclasses() - + +# passing reviewed in from reviews.urls and out to review_list for appropriate template header rendering + if reviewed == 'all': + queryset = queryset.select_related("result").select_subclasses() + reviewed = 'all_reviews' + elif reviewed == 'reviewed': + queryset = queryset.filter(reviews__user=request.user) + reviewed = 'user_reviewed' + else: + queryset = queryset.exclude(reviews__user=request.user).exclude(speaker=request.user) + reviewed = 'user_not_reviewed' + proposals = proposals_generator(request, queryset) ctx = { "proposals": proposals, "section": section, + "reviewed": reviewed, } return render(request, "reviews/review_list.html", ctx) - @login_required def review_list(request, section_slug, user_pk): From c2b429bacf06d9d4becac9f4a8a61254d5407625 Mon Sep 17 00:00:00 2001 From: florapdx Date: Mon, 29 Apr 2013 14:03:37 -0700 Subject: [PATCH 07/12] added urls for reviewed and not-reviewed by section --- symposion/reviews/urls.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/symposion/reviews/urls.py b/symposion/reviews/urls.py index b0968bca..564bd35e 100644 --- a/symposion/reviews/urls.py +++ b/symposion/reviews/urls.py @@ -2,7 +2,9 @@ from django.conf.urls.defaults import patterns, url urlpatterns = patterns("symposion.reviews.views", - url(r"^section/(?P[\w\-]+)/$", "review_section", name="review_section"), + url(r"^section/(?P[\w\-]+)/all/$", "review_section", {"reviewed": "all"}, name="review_section"), + url(r"^section/(?P[\w\-]+)/reviewed/$", "review_section", {"reviewed": "reviewed"}, name="user_reviewed"), + url(r"^section/(?P[\w\-]+)/not_reviewed/$", "review_section", {"reviewed": "not_reviewed"}, name="user_not_reviewed"), url(r"^section/(?P[\w\-]+)/assignments/$", "review_section", {"assigned": True}, name="review_section_assignments"), url(r"^section/(?P[\w\-]+)/status/$", "review_status", name="review_status"), url(r"^section/(?P[\w\-]+)/status/(?P\w+)/$", "review_status", name="review_status"), From f136a7c13be455df56ec92e0278a243ba0ddb5e0 Mon Sep 17 00:00:00 2001 From: florapdx Date: Mon, 29 Apr 2013 14:05:27 -0700 Subject: [PATCH 08/12] added code in review_section iterator to add links to all, user reviewed, and user not-reviewed --- symposion/templates/dashboard.html | 50 +++--------------------------- 1 file changed, 5 insertions(+), 45 deletions(-) diff --git a/symposion/templates/dashboard.html b/symposion/templates/dashboard.html index 23b85cbc..0d2d23e8 100644 --- a/symposion/templates/dashboard.html +++ b/symposion/templates/dashboard.html @@ -132,58 +132,18 @@

{% trans "Reviews" %}

{% user_reviews as user_reviews %} - {% user_not_reviewed as user_not_reviewed %}
-

Review Sections

+

Reviews by Section

-

Proposals you have reviewed

- - - - - - - - {% for review in user_reviews %} - - - - - - {% endfor %} - -
#Speaker / TitleYour Vote
{{ review.proposal.number }} - {{ review.proposal.speaker }} -
- {{ review.proposal.title }} -
{{ review.vote }}
- -

Proposals you have yet to review

- - - - - - - {% for proposal in user_not_reviewed %} - - - - - {% endfor %} - -
#Speaker / Title
{{ proposal.number }} - {{ proposal.speaker }} -
- {{ proposal.title }} -
- {% comment %}

My Assignments

From c3404459e17b37eac6794897a6316116a59ee053 Mon Sep 17 00:00:00 2001 From: florapdx Date: Mon, 29 Apr 2013 14:06:25 -0700 Subject: [PATCH 09/12] added markup to render new all, user reviewed, and user not-reviewed pages --- symposion/templates/reviews/review_list.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/symposion/templates/reviews/review_list.html b/symposion/templates/reviews/review_list.html index 8da4cb68..36504604 100644 --- a/symposion/templates/reviews/review_list.html +++ b/symposion/templates/reviews/review_list.html @@ -1,6 +1,14 @@ {% extends "reviews/base.html" %} {% block body %} -

{{ section }}

+

{{ section }}

+ {% if reviewed == 'all_reviews' %} +

All proposals

+ {% elif reviewed == 'user_reviewed' %} +

Proposals you have reviewed

+ {% else %} +

Proposals you have not yet reviewed

+ {% endif %} + {% include "reviews/_review_table.html" %} {% endblock %} From 9911a68a7a7c1724c84a3695912d1b6ed30950e6 Mon Sep 17 00:00:00 2001 From: florapdx Date: Mon, 29 Apr 2013 14:11:55 -0700 Subject: [PATCH 10/12] removed block for template tag user_reviewed --- symposion/templates/dashboard.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/symposion/templates/dashboard.html b/symposion/templates/dashboard.html index 0d2d23e8..a88b4a3f 100644 --- a/symposion/templates/dashboard.html +++ b/symposion/templates/dashboard.html @@ -131,7 +131,7 @@

{% trans "Reviews" %}

- {% user_reviews as user_reviews %} +

Reviews by Section

From 22b7265649bb05e240aa9dd946d5cdd10510bc78 Mon Sep 17 00:00:00 2001 From: florapdx Date: Mon, 29 Apr 2013 14:13:10 -0700 Subject: [PATCH 11/12] removed user_reviews template tag; now being handled by review_section view --- symposion/reviews/templatetags/review_tags.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/symposion/reviews/templatetags/review_tags.py b/symposion/reviews/templatetags/review_tags.py index 33879d53..abfb136d 100644 --- a/symposion/reviews/templatetags/review_tags.py +++ b/symposion/reviews/templatetags/review_tags.py @@ -6,20 +6,6 @@ from symposion.proposals.models import ProposalBase register = template.Library() - -@register.assignment_tag(takes_context=True) -def user_reviews(context): - request = context["request"] - reviews = Review.objects.filter(user=request.user) - return reviews - -@register.assignment_tag(takes_context=True) -def user_not_reviewed(context): - request = context["request"] - already_reviewed = [r.proposal_id for r in Review.objects.filter(user=request.user)] - yet_to_review = ProposalBase.objects.exclude(id__in=[p.id for p in ProposalBase.objects.filter(id__in=already_reviewed)]).exclude(speaker=request.user) - return yet_to_review - @register.assignment_tag(takes_context=True) def review_assignments(context): request = context["request"] From 306dc683b8ee3f7a8823c26cd82630364e5f4c7b Mon Sep 17 00:00:00 2001 From: florapdx Date: Mon, 29 Apr 2013 14:14:47 -0700 Subject: [PATCH 12/12] removed proposalbase import from previous version --- symposion/reviews/templatetags/review_tags.py | 1 - 1 file changed, 1 deletion(-) diff --git a/symposion/reviews/templatetags/review_tags.py b/symposion/reviews/templatetags/review_tags.py index abfb136d..9a73f878 100644 --- a/symposion/reviews/templatetags/review_tags.py +++ b/symposion/reviews/templatetags/review_tags.py @@ -1,7 +1,6 @@ from django import template from symposion.reviews.models import Review, ReviewAssignment -from symposion.proposals.models import ProposalBase register = template.Library()