Makes the attendee list work better.

This commit is contained in:
Christopher Neugebauer 2016-09-02 15:37:57 +10:00
parent e27e322c41
commit d58b2811f9

View file

@ -240,7 +240,8 @@ def attendee_list(request):
attendees = people.Attendee.objects.all().select_related( attendees = people.Attendee.objects.all().select_related(
"attendeeprofilebase", "attendeeprofilebase",
) )
attendees = attendees.annotate(
attendees = attendees.values("id", "user__email").annotate(
has_registered=Count( has_registered=Count(
Q(user__invoice__status=commerce.Invoice.STATUS_PAID) Q(user__invoice__status=commerce.Invoice.STATUS_PAID)
), ),
@ -254,9 +255,9 @@ def attendee_list(request):
for attendee in attendees: for attendee in attendees:
data.append([ data.append([
attendee.user.id, attendee["id"],
attendee.user.email, attendee["user__email"],
attendee.has_registered > 0, attendee["has_registered"],
]) ])
# Sort by whether they've registered, then ID. # Sort by whether they've registered, then ID.