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
...
 
@@ -64,12 +64,19 @@ class AttendeeProfileBase(models.Model):
 
            The name of a field that stores the attendee's name. This is used
 
            to pre-fill the attendee's name from their Speaker profile, if they
 
            have one.
 
        '''
 
        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):
 
        '''
 

	
 
        Returns:
 
            A representation of this attendee profile for the purpose
 
            of rendering to an invoice. This should include any information
registrasion/reporting/views.py
Show inline comments
...
 
@@ -329,31 +329,33 @@ def attendee(request, form, attendee_id=None):
 

	
 
def attendee_list(request):
 
    ''' Returns a list of all attendees. '''
 

	
 
    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)