Changeset - cb50f2a3bea9
[Not reviewed]
0 1 0
Christopher Neugebauer - 8 years ago 2016-09-13 08:53:01
chrisjrn@gmail.com
Replaces a bunch of reports with QuerysetReports
1 file changed with 4 insertions and 16 deletions:
0 comments (0 inline, 0 general)
registrasion/reporting/views.py
Show inline comments
...
 
@@ -218,41 +218,29 @@ def product_status(request, form):
 

	
 
@report_view("Credit notes")
 
def credit_notes(request, form):
 
    ''' Shows all of the credit notes in the system. '''
 

	
 
    notes = commerce.CreditNote.objects.all().select_related(
 
        "creditnoterefund",
 
        "creditnoteapplication",
 
        "invoice",
 
        "invoice__user__attendee__attendeeprofilebase",
 
    )
 

	
 
    headings = [
 
        "id", "Owner", "Status", "Value",
 
    ]
 

	
 
    data = []
 
    for note in notes:
 
        data.append([
 
            note.id,
 
            note.invoice.user.attendee.attendeeprofilebase.invoice_recipient(),
 
            note.status,
 
            note.value,
 
        ])
 

	
 
    return ListReport(
 
    return QuerysetReport(
 
        "Credit Notes",
 
        headings,
 
        data,
 
        ["id", "invoice__user__attendee__attendeeprofilebase__invoice_recipient", "status", "value"],  # NOQA
 
        notes,
 
        headings=["id", "Owner", "Status", "Value"],
 
        link_view=views.credit_note,
 
    )
 

	
 

	
 
@report_view("Attendee", form_type=forms.UserIdForm)
 
def attendee(request, form, user_id=None):
 
    ''' Returns a list of all manifested attendees if no attendee is specified,
 
    else displays the attendee manifest. '''
 

	
 
    if user_id is None and not form.has_changed():
 
        return attendee_list(request)
 

	
0 comments (0 inline, 0 general)