project/scipycon/registration/views.py
changeset 353 bd083c34aa43
parent 352 781d7bc60cc9
child 354 5fb620cdacf2
equal deleted inserted replaced
352:781d7bc60cc9 353:bd083c34aa43
   403     response['Content-Disposition'] = 'attachment; filename=%s' % (
   403     response['Content-Disposition'] = 'attachment; filename=%s' % (
   404       filename)
   404       filename)
   405 
   405 
   406     output = csv.writer(response)
   406     output = csv.writer(response)
   407 
   407 
   408     output.writerow(['Name', 'City',
   408     output.writerow(['Name', 'Gender', 'City',
   409                      'Registration Fees Paid',
   409                      'Registration Fees Paid',
   410                      'Attending Conference',
   410                      'Attending Conference',
   411                      'Attending Tutorial',
   411                      'Attending Tutorial',
   412                      'Attending Sprint',
   412                      'Attending Sprint',
   413                      'Laptop Identification Number',
   413                      'Laptop Identification Number',
   420                      'Accommodation on 17th night'])
   420                      'Accommodation on 17th night'])
   421 
   421 
   422     regs = Registration.objects.all()
   422     regs = Registration.objects.all()
   423     for reg in regs:
   423     for reg in regs:
   424         row = []
   424         row = []
   425         row.append('"%"' % reg.registrant.get_full_name())
   425 
   426         row.append(reg.city)
       
   427         payment, create = reg.registrant.payment_set.get_or_create(
   426         payment, create = reg.registrant.payment_set.get_or_create(
   428           user=reg.registrant, scope=reg.scope)
   427           user=reg.registrant, scope=reg.scope)
       
   428         acco, created = reg.registrant.accommodation_set.get_or_create(
       
   429           user=reg.registrant, scope=reg.scope)
       
   430         wifi, create = reg.registrant.wifi_set.get_or_create(
       
   431           user=reg.registrant, scope=reg.scope)
       
   432 
       
   433         row.append('"%"' % reg.registrant.get_full_name())
       
   434         row.append(acco.sex)
       
   435         row.append(reg.city)
   429         row.append('Yes' if payment.confirmed else 'No')
   436         row.append('Yes' if payment.confirmed else 'No')
   430         row.append('Yes' if reg.conference else 'No')
   437         row.append('Yes' if reg.conference else 'No')
   431         row.append('Yes' if reg.tutorial else 'No')
   438         row.append('Yes' if reg.tutorial else 'No')
   432         row.append('Yes' if reg.sprint else 'No')
   439         row.append('Yes' if reg.sprint else 'No')
   433         wifi, create = reg.registrant.wifi_set.get_or_create(
       
   434           user=reg.registrant, scope=reg.scope)
       
   435         row.append(wifi.registration_id)
   440         row.append(wifi.registration_id)
   436         row.append('Yes' if payment.acco_confirmed
   441         row.append('Yes' if payment.acco_confirmed
   437            else 'No')
   442            else 'No')
   438         acco, created = reg.registrant.accommodation_set.get_or_create(
       
   439           user=reg.registrant, scope=reg.scope)
       
   440         row.append('Yes' if acco.accommodation_on_1st else 'No')
   443         row.append('Yes' if acco.accommodation_on_1st else 'No')
   441         row.append('Yes' if acco.accommodation_on_2nd else 'No')
   444         row.append('Yes' if acco.accommodation_on_2nd else 'No')
   442         row.append('Yes' if acco.accommodation_on_3rd else 'No')
   445         row.append('Yes' if acco.accommodation_on_3rd else 'No')
   443         row.append('Yes' if acco.accommodation_on_4th else 'No')
   446         row.append('Yes' if acco.accommodation_on_4th else 'No')
   444         row.append('Yes' if acco.accommodation_on_5th else 'No')
   447         row.append('Yes' if acco.accommodation_on_5th else 'No')