From 3dd7468365452083ee0bd4090cfa38c0749418fb Mon Sep 17 00:00:00 2001 From: James Tauber Date: Thu, 6 Sep 2012 22:36:40 -0400 Subject: [PATCH] first pass at models and view for table with selection --- symposion/reviews/models.py | 18 +++ symposion/reviews/urls.py | 3 +- symposion/reviews/views.py | 14 ++ .../reviews/result_notification.html | 132 ++++++++++++++++++ 4 files changed, 166 insertions(+), 1 deletion(-) create mode 100644 symposion/templates/reviews/result_notification.html diff --git a/symposion/reviews/models.py b/symposion/reviews/models.py index 3fb405d3..8a7db88b 100644 --- a/symposion/reviews/models.py +++ b/symposion/reviews/models.py @@ -284,6 +284,24 @@ class Comment(models.Model): commented_at = models.DateTimeField(default=datetime.now) +class NotificationTemplate(models.Model): + + label = models.CharField(max_length=100) + subject = models.CharField(max_length=100) + body = models.TextField() + + +class ResultNotification(models.Model): + + proposal = models.ForeignKey("proposals.ProposalBase", related_name="notifications") + template = models.ForeignKey(NotificationTemplate, null=True, blank=True, on_delete=models.SET_NULL) + timestamp = models.DateTimeField(default=datetime.now) + to_address = models.EmailField() + from_address = models.EmailField() + subject = models.CharField(max_length=100) + body = models.TextField() + + def promote_proposal(proposal): if hasattr(proposal, "presentation") and proposal.presentation: diff --git a/symposion/reviews/urls.py b/symposion/reviews/urls.py index 6770cb88..8336dc04 100644 --- a/symposion/reviews/urls.py +++ b/symposion/reviews/urls.py @@ -5,10 +5,11 @@ urlpatterns = patterns("symposion.reviews.views", url(r"^section/(?P[\w\-]+)/$", "review_section", name="review_section"), 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"), + url(r"^section/(?P[\w\-]+)/status/(?P\w+)/$", "review_status", name="review_status"), url(r"^section/(?P[\w\-]+)/list/(?P\d+)/$", "review_list", name="review_list_user"), url(r"^section/(?P[\w\-]+)/admin/$", "review_admin", name="review_admin"), url(r"^section/(?P[\w\-]+)/admin/accept/$", "review_bulk_accept", name="review_bulk_accept"), + url(r"^section/(?P[\w\-]+)/notification/(?P\w+)/$", "result_notification", name="result_notification"), url(r"^review/(?P\d+)/$", "review_detail", name="review_detail"), diff --git a/symposion/reviews/views.py b/symposion/reviews/views.py index 71cac478..ef90c2b0 100644 --- a/symposion/reviews/views.py +++ b/symposion/reviews/views.py @@ -369,3 +369,17 @@ def review_bulk_accept(request, section_slug): return render(request, "reviews/review_bulk_accept.html", { "form": form, }) + + +@login_required +def result_notification(request, section_slug, status): + if not request.user.has_perm("reviews.can_manage_%s" % section_slug): + return access_not_permitted(request) + + proposals = ProposalBase.objects.filter(kind__section__slug=section_slug, result__status=status).select_related("speaker__user", "result").select_subclasses() + + ctx = { + "section_slug": section_slug, + "proposals": proposals, + } + return render(request, "reviews/result_notification.html", ctx) diff --git a/symposion/templates/reviews/result_notification.html b/symposion/templates/reviews/result_notification.html new file mode 100644 index 00000000..f16993c3 --- /dev/null +++ b/symposion/templates/reviews/result_notification.html @@ -0,0 +1,132 @@ +{% extends "reviews/base.html" %} + +{% load i18n %} + +{% block extra_style %} + +{% endblock %} + +{% block body %} +

Result Notification

+ + 0 selected + + + + + + + + + + + + + {% for proposal in proposals %} + + + + + + + + + {% endfor %} + +
#{% trans "Speaker / Title" %}{% trans "Category" %}{% trans "Status" %}{% trans "Notified?" %}
{{ proposal.number }} + + {{ proposal.speaker }} +
+ {{ proposal.title }} +
+
{{ proposal.track }} + {% with proposal.result.status as status %} +
+ {% if status != "undecided" %} + {{ status }} + {% endif %} +
+ {% endwith %} +
+
+{% endblock %} + +{% block extra_script %} + +{% endblock %}