@ensure_csrf_cookie
@cache_control(no_cache=True, no_store=True, must_revalidate=True)
@require_level('staff')
@require_POST
def get_registration_codes(request, course_id):
 course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)
 registration_codes = CourseRegistrationCode.objects.filter(course_id=course_id).order_by('invoice_item__invoice__company_name')
 company_name = request.POST['download_company_name']
 if company_name:
  registration_codes = registration_codes.filter(invoice_item__invoice__company_name=company_name)
 csv_type = 'download'
 return registration_codes_csv('Registration_Codes.csv', registration_codes, csv_type)

@ ensure_csrf_cookie @ cache_control ( no_cache = True , no_store = True , must_revalidate = True ) @ require_level ( 'staff' ) @ require_POST def get_registration_codes ( request , course_id ) : course_id = SlashSeparatedCourseKey . from_deprecated_string ( course_id ) registration_codes = CourseRegistrationCode . objects . filter ( course_id = course_id ) . order_by ( 'invoice_item__invoice__company_name' ) company_name = request . POST [ 'download_company_name' ] if company_name : registration_codes = registration_codes . filter ( invoice_item__invoice__company_name = company_name ) csv_type = 'download' return registration_codes_csv ( 'Registration_Codes.csv' , registration_codes , csv_type )
respond with csv which contains a summary of all registration codes .