Changeset - f3a08a82bb96
[Not reviewed]
0 2 0
Christopher Neugebauer - 8 years ago 2016-09-03 02:45:21
chrisjrn@gmail.com
Shows the attendee’s name in the attendee list.
2 files changed with 15 insertions and 6 deletions:
0 comments (0 inline, 0 general)
registrasion/models/people.py
Show inline comments
...
 
@@ -67,6 +67,13 @@ class AttendeeProfileBase(models.Model):
 
        '''
 
        return None
 

	
 
    def attendee_name(self):
 
        if type(self) == AttendeeProfileBase:
 
            real = AttendeeProfileBase.objects.get_subclass(id=self.id)
 
        else:
 
            real = self
 
        return getattr(real, real.name_field())
 

	
 
    def invoice_recipient(self):
 
        '''
 

	
registrasion/reporting/views.py
Show inline comments
...
 
@@ -332,28 +332,30 @@ def attendee_list(request):
 

	
 
    attendees = people.Attendee.objects.all().select_related(
 
        "attendeeprofilebase",
 
        "user",
 
    )
 

	
 
    attendees = attendees.values("id", "user__email").annotate(
 
    attendees = attendees.annotate(
 
        has_registered=Count(
 
            Q(user__invoice__status=commerce.Invoice.STATUS_PAID)
 
        ),
 
    )
 

	
 
    headings = [
 
        "User ID", "Email", "Has registered",
 
        "User ID", "Name", "Email", "Has registered",
 
    ]
 

	
 
    data = []
 

	
 
    for attendee in attendees:
 
        data.append([
 
            attendee["id"],
 
            attendee["user__email"],
 
            attendee["has_registered"],
 
            attendee.id,
 
            attendee.attendeeprofilebase.attendee_name(),
 
            attendee.user.email,
 
            attendee.has_registered > 0,
 
        ])
 

	
 
    # Sort by whether they've registered, then ID.
 
    data.sort(key=lambda attendee: (-attendee[2], attendee[0]))
 
    data.sort(key=lambda attendee: (-attendee[3], attendee[0]))
 

	
 
    return Report("Attendees", headings, data, link_view="attendee")
0 comments (0 inline, 0 general)