Ignore:
Timestamp:
15 Nov 2020, 19:41:33 (4 years ago)
Author:
Henrik Bettermann
Message:

Implement PGApplicantExporter.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/export.py

    r16078 r16317  
    5151        return super(CustomApplicantPaymentExporter, self).fields + (
    5252            'r_pay_reference',)
     53
     54class PGApplicantExporter(NigeriaApplicantExporter):
     55    """Exports pg applicants only.
     56    """
     57
     58    grok.name('pg_applicants')
     59    title = 'PG Applicants'
     60
     61    def is_postgrad(self, applicant):
     62        course_studied = getattr(applicant, 'course_studied', None)
     63        if course_studied and (course_studied.study_mode.startswith('pg')
     64              or course_studied.study_mode.startswith('special_pg')):
     65            return True
     66        return False
     67
     68    def export(self, applicants, filepath=None):
     69        """
     70        """
     71        writer, outfile = self.get_csv_writer(filepath)
     72        for applicant in applicants:
     73            if self.is_postgrad(applicant):
     74                self.write_item(applicant, writer)
     75        return self.close_outfile(filepath, outfile)
Note: See TracChangeset for help on using the changeset viewer.