Ignore:
Timestamp:
25 Jun 2013, 04:02:35 (12 years ago)
Author:
Henrik Bettermann
Message:

Do not venue and date prior to payment.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/applicants/browser.py

    r10223 r10377  
    7878    """
    7979
     80    def _not_paid(self):
     81        return self.context.state in ('initialized', 'started',)
     82
    8083    @property
    8184    def form_fields(self):
     
    98101        #form_fields['perm_address'].custom_widget = BytesDisplayWidget
    99102        form_fields['notice'].custom_widget = BytesDisplayWidget
     103        if not getattr(self.context, 'student_id'):
     104            form_fields = form_fields.omit('student_id')
     105        if not getattr(self.context, 'screening_score'):
     106            form_fields = form_fields.omit('screening_score')
     107        if not getattr(self.context, 'screening_venue') or self._not_paid():
     108            form_fields = form_fields.omit('screening_venue')
     109        if not getattr(self.context, 'screening_date') or self._not_paid():
     110            form_fields = form_fields.omit('screening_date')
     111        return form_fields
     112
     113class NigeriaPDFApplicationSlip(PDFApplicationSlip):
     114
     115    def _reduced_slip(self):
     116        return getattr(self.context, 'result_uploaded', False)
     117
     118    @property
     119    def form_fields(self):
     120        if self.target is not None and self.target.startswith('pg'):
     121            form_fields = grok.AutoFields(INigeriaPGApplicant)
     122            for field in PG_OMIT_PDF_FIELDS:
     123                form_fields = form_fields.omit(field)
     124        elif self.target is not None and self.target.startswith('putme'):
     125            form_fields = grok.AutoFields(INigeriaUGApplicant)
     126            if self._reduced_slip():
     127                for field in PUTME_OMIT_RESULT_SLIP_FIELDS:
     128                    form_fields = form_fields.omit(field)
     129            else:
     130                for field in PUTME_OMIT_PDF_FIELDS:
     131                    form_fields = form_fields.omit(field)
     132        elif self.target is not None and self.target.startswith('pude'):
     133            form_fields = grok.AutoFields(INigeriaUGApplicant)
     134            if self._reduced_slip():
     135                for field in PUDE_OMIT_RESULT_SLIP_FIELDS:
     136                    form_fields = form_fields.omit(field)
     137            else:
     138                for field in PUDE_OMIT_PDF_FIELDS:
     139                    form_fields = form_fields.omit(field)
     140        else:
     141            form_fields = grok.AutoFields(INigeriaUGApplicant)
     142            for field in UG_OMIT_PDF_FIELDS:
     143                form_fields = form_fields.omit(field)
    100144        if not getattr(self.context, 'student_id'):
    101145            form_fields = form_fields.omit('student_id')
     
    108152        return form_fields
    109153
    110 class NigeriaPDFApplicationSlip(PDFApplicationSlip):
    111 
    112     def _reduced_slip(self):
    113         return getattr(self.context, 'result_uploaded', False)
    114 
    115     #@property
    116     #def note(self):
    117     #    if self.target is not None and not self.target.startswith('pg') \
    118     #        and not self._reduced_slip():
    119     #        return _(u'<br /><br /><br />'
    120     #                  'Comfirm your exam venue 72 hours to the exam.')
    121     #    return
    122 
    123     @property
    124     def form_fields(self):
    125         if self.target is not None and self.target.startswith('pg'):
    126             form_fields = grok.AutoFields(INigeriaPGApplicant)
    127             for field in PG_OMIT_PDF_FIELDS:
    128                 form_fields = form_fields.omit(field)
    129         elif self.target is not None and self.target.startswith('putme'):
    130             form_fields = grok.AutoFields(INigeriaUGApplicant)
    131             if self._reduced_slip():
    132                 for field in PUTME_OMIT_RESULT_SLIP_FIELDS:
    133                     form_fields = form_fields.omit(field)
    134             else:
    135                 for field in PUTME_OMIT_PDF_FIELDS:
    136                     form_fields = form_fields.omit(field)
    137         elif self.target is not None and self.target.startswith('pude'):
    138             form_fields = grok.AutoFields(INigeriaUGApplicant)
    139             if self._reduced_slip():
    140                 for field in PUDE_OMIT_RESULT_SLIP_FIELDS:
    141                     form_fields = form_fields.omit(field)
    142             else:
    143                 for field in PUDE_OMIT_PDF_FIELDS:
    144                     form_fields = form_fields.omit(field)
    145         else:
    146             form_fields = grok.AutoFields(INigeriaUGApplicant)
    147             for field in UG_OMIT_PDF_FIELDS:
    148                 form_fields = form_fields.omit(field)
    149         if not getattr(self.context, 'student_id'):
    150             form_fields = form_fields.omit('student_id')
    151         if not getattr(self.context, 'screening_score'):
    152             form_fields = form_fields.omit('screening_score')
    153         if not getattr(self.context, 'screening_venue'):
    154             form_fields = form_fields.omit('screening_venue')
    155         if not getattr(self.context, 'screening_date'):
    156             form_fields = form_fields.omit('screening_date')
    157         return form_fields
    158 
    159154class NigeriaApplicantManageFormPage(ApplicantManageFormPage):
    160155    """A full edit view for applicant data.
Note: See TracChangeset for help on using the changeset viewer.