parent
7c5c155370
commit
94a8c3e3d9
3 changed files with 54 additions and 0 deletions
|
@ -1,6 +1,8 @@
|
|||
from registrasion.models import conditions
|
||||
from registrasion.models import inventory
|
||||
|
||||
from symposion.proposals import models as proposals_models
|
||||
|
||||
from django import forms
|
||||
|
||||
# Reporting forms.
|
||||
|
@ -31,6 +33,14 @@ class UserIdForm(forms.Form):
|
|||
)
|
||||
|
||||
|
||||
class ProposalKindForm(forms.Form):
|
||||
kind = forms.ModelMultipleChoiceField(
|
||||
queryset=proposals_models.ProposalKind.objects.all(),
|
||||
required=False,
|
||||
)
|
||||
|
||||
|
||||
|
||||
def model_fields_form_factory(model):
|
||||
''' Creates a form for specifying fields from a model to display. '''
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import datetime
|
|||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.decorators import user_passes_test
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.db import models
|
||||
from django.db.models import F, Q
|
||||
|
@ -18,6 +19,8 @@ from registrasion.models import people
|
|||
from registrasion import util
|
||||
from registrasion import views
|
||||
|
||||
from symposion.schedule import models as schedule_models
|
||||
|
||||
from reports import get_all_reports
|
||||
from reports import Links
|
||||
from reports import ListReport
|
||||
|
@ -600,3 +603,39 @@ def attendee_data(request, form, user_id=None):
|
|||
"Attendees by item with profile data", headings, data, link_view=attendee
|
||||
))
|
||||
return output
|
||||
|
||||
|
||||
@report_view(
|
||||
"Speaker Registration Status",
|
||||
form_type=forms.ProposalKindForm,
|
||||
)
|
||||
def speaker_registrations(request, form):
|
||||
''' Shows registration status for speakers with a given proposal kind. '''
|
||||
|
||||
kinds = form.cleaned_data["kind"]
|
||||
|
||||
presentations = schedule_models.Presentation.objects.filter(
|
||||
proposal_base__kind=kinds,
|
||||
).exclude(
|
||||
cancelled=True,
|
||||
)
|
||||
|
||||
users = User.objects.filter(
|
||||
Q(speaker_profile__presentations__in=presentations) |
|
||||
Q(speaker_profile__copresentations__in=presentations)
|
||||
)
|
||||
|
||||
paid_carts = commerce.Cart.objects.filter(status=commerce.Cart.STATUS_PAID)
|
||||
|
||||
paid_carts = Case(When(cart__in=paid_carts, then=Value(1)), default=Value(0), output_field=models.IntegerField())
|
||||
users = users.annotate(paid_carts=Sum(paid_carts))
|
||||
users=users.order_by("paid_carts")
|
||||
|
||||
return QuerysetReport(
|
||||
"Speaker Registration Status",
|
||||
["id", "speaker_profile__name", "email", "paid_carts",],
|
||||
users,
|
||||
link_view=attendee,
|
||||
)
|
||||
|
||||
return []
|
||||
|
|
|
@ -54,6 +54,11 @@ reports = [
|
|||
),
|
||||
url(r"^product_status/?$", rv.product_status, name="product_status"),
|
||||
url(r"^reconciliation/?$", rv.reconciliation, name="reconciliation"),
|
||||
url(
|
||||
r"^speaker_registrations/?$",
|
||||
rv.speaker_registrations,
|
||||
name="speaker_registrations",
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue