added result_notification_prepare view and stubbed out result_notification_send
This commit is contained in:
parent
3c2a0de89d
commit
5fefff0a3d
3 changed files with 83 additions and 38 deletions
|
@ -10,6 +10,7 @@ urlpatterns = patterns("symposion.reviews.views",
|
|||
url(r"^section/(?P<section_slug>[\w\-]+)/admin/$", "review_admin", name="review_admin"),
|
||||
url(r"^section/(?P<section_slug>[\w\-]+)/admin/accept/$", "review_bulk_accept", name="review_bulk_accept"),
|
||||
url(r"^section/(?P<section_slug>[\w\-]+)/notification/(?P<status>\w+)/$", "result_notification", name="result_notification"),
|
||||
url(r"^section/(?P<section_slug>[\w\-]+)/notification/(?P<status>\w+)/prepare/$", "result_notification_prepare", name="result_notification_prepare"),
|
||||
|
||||
url(r"^review/(?P<pk>\d+)/$", "review_detail", name="review_detail"),
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from django.db.models import Q
|
||||
from django.http import HttpResponseBadRequest, HttpResponseNotAllowed
|
||||
from django.shortcuts import render, redirect, get_object_or_404
|
||||
from django.views.decorators.http import require_POST
|
||||
|
||||
|
@ -380,6 +381,41 @@ def result_notification(request, section_slug, status):
|
|||
|
||||
ctx = {
|
||||
"section_slug": section_slug,
|
||||
"status": status,
|
||||
"proposals": proposals,
|
||||
}
|
||||
return render(request, "reviews/result_notification.html", ctx)
|
||||
|
||||
|
||||
@login_required
|
||||
def result_notification_prepare(request, section_slug, status):
|
||||
if request.method != "POST":
|
||||
return HttpResponseNotAllowed(["POST"])
|
||||
|
||||
proposal_pks = []
|
||||
try:
|
||||
for pk in request.POST.getlist("_selected_action"):
|
||||
proposal_pks.append(int(pk))
|
||||
except ValueError:
|
||||
return HttpResponseBadRequest()
|
||||
proposals = ProposalBase.objects.filter(
|
||||
kind__section__slug=section_slug,
|
||||
result__status=status,
|
||||
)
|
||||
proposals = proposals.filter(pk__in=proposal_pks)
|
||||
proposals = proposals.select_related("speaker__user", "result")
|
||||
proposals = proposals.select_subclasses()
|
||||
|
||||
ctx = {
|
||||
"section_slug": section_slug,
|
||||
"status": status,
|
||||
"proposals": proposals,
|
||||
}
|
||||
return render(request, "reviews/result_notification_prepare.html", ctx)
|
||||
|
||||
|
||||
def result_notification_send(request, section_slug, status):
|
||||
if request.method != "POST":
|
||||
return HttpResponseNotAllowed(["POST"])
|
||||
|
||||
# @@@ discuss with jtauber about how to handle this
|
||||
|
|
|
@ -15,44 +15,52 @@
|
|||
|
||||
<span class="action-counter">0</span> selected
|
||||
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<th><input type="checkbox" id="action-toggle"></th>
|
||||
<th>#</th>
|
||||
<th>{% trans "Speaker / Title" %}</th>
|
||||
<th>{% trans "Category" %}</th>
|
||||
<th>{% trans "Status" %}</th>
|
||||
<th>{% trans "Notified?" %}</th>
|
||||
</thead>
|
||||
<form method="post" action="{% url result_notification_prepare section_slug status %}">
|
||||
|
||||
<tbody>
|
||||
{% for proposal in proposals %}
|
||||
<tr>
|
||||
<td><input class="action-select" type="checkbox" name="_selected_action" value="{{ proposal.pk }}"></td>
|
||||
<td>{{ proposal.number }}</td>
|
||||
<td>
|
||||
<a href="{% url review_detail proposal.pk %}">
|
||||
<small><strong>{{ proposal.speaker }}</strong></small>
|
||||
<br />
|
||||
{{ proposal.title }}
|
||||
</a>
|
||||
</td>
|
||||
<td>{{ proposal.track }}</td>
|
||||
<td>
|
||||
{% with proposal.result.status as status %}
|
||||
<div class="{{ status }}">
|
||||
{% if status != "undecided" %}
|
||||
<span>{{ status }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endwith %}
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<th><input type="checkbox" id="action-toggle"></th>
|
||||
<th>#</th>
|
||||
<th>{% trans "Speaker / Title" %}</th>
|
||||
<th>{% trans "Category" %}</th>
|
||||
<th>{% trans "Status" %}</th>
|
||||
<th>{% trans "Notified?" %}</th>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for proposal in proposals %}
|
||||
<tr>
|
||||
<td><input class="action-select" type="checkbox" name="_selected_action" value="{{ proposal.pk }}"></td>
|
||||
<td>{{ proposal.number }}</td>
|
||||
<td>
|
||||
<a href="{% url review_detail proposal.pk %}">
|
||||
<small><strong>{{ proposal.speaker }}</strong></small>
|
||||
<br />
|
||||
{{ proposal.title }}
|
||||
</a>
|
||||
</td>
|
||||
<td>{{ proposal.track }}</td>
|
||||
<td>
|
||||
{% with proposal.result.status as status %}
|
||||
<div class="{{ status }}">
|
||||
{% if status != "undecided" %}
|
||||
<span>{{ status }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endwith %}
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<button type="submit" class="btn btn-primary">POST IT</button>
|
||||
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_script %}
|
||||
|
|
Loading…
Reference in a new issue