registrasion/reporting/views.py
def attendee_list(request):
    ''' Returns a list of all attendees. '''

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

    profiles = AttendeeProfile.objects.filter(
        attendee__in=attendees
    ).select_related(
        "attendee", "attendee__user",
    )
    profiles_by_attendee = dict((i.attendee, i) for i in profiles)

    attendees = attendees.annotate(
        has_registered=Count(
            Q(user__invoice__status=commerce.Invoice.STATUS_PAID)
        ),
    )

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

    data = []

    for a in attendees:
        data.append([
            a.user.id,
            (profiles_by_attendee[a].attendee_name()
                if a in profiles_by_attendee else ""),
            a.user.email,
            a.has_registered > 0,
        ])

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

    return AttendeeListReport("Attendees", headings, data, link_view=attendee)
def attendee_list(request):
    ''' Returns a list of all attendees. '''

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

    profiles = AttendeeProfile.objects.filter(
        attendee__in=attendees
    ).select_related(
        "attendee", "attendee__user",
    )
    profiles_by_attendee = dict((i.attendee, i) for i in profiles)

    attendees = attendees.annotate(
        has_registered=Count(
            Q(user__invoice__status=commerce.Invoice.STATUS_PAID)
        ),
    )

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

    data = []

    for a in attendees:
        data.append([
            a.user.id,
            (profiles_by_attendee[a].attendee_name()
                if a in profiles_by_attendee else ""),
            a.user.email,
            a.has_registered > 0,
        ])

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

    return AttendeeListReport("Attendees", headings, data, link_view=attendee)
def attendee_list ( request ) : attendees = people . Attendee . objects . select_related ( "attendeeprofilebase" , "user" , ) profiles = AttendeeProfile . objects . filter ( attendee__in = attendees ) . select_related ( "attendee" , "attendee__user" , ) profiles_by_attendee = dict ( ( i . attendee , i ) for i in profiles ) attendees = attendees . annotate ( has_registered = Count ( Q ( user__invoice__status = commerce . Invoice . STATUS_PAID ) ) , ) headings = [ "User ID" , "Name" , "Email" , "Has registered" , ] data = [ ] for a in attendees : data . append ( [ a . user . id , ( profiles_by_attendee [ a ] . attendee_name ( ) if a in profiles_by_attendee else "" ) , a . user . email , a . has_registered > 0 , ] ) # Sort by whether they've registered, then ID. data . sort ( key = lambda a : ( - a [ 3 ] , a [ 0 ] ) ) return AttendeeListReport ( "Attendees" , headings , data , link_view = attendee )
Returns a list of all attendees.
Returns a list of all attendees .