Changeset 10206 for main/waeup.futminna


Ignore:
Timestamp:
22 May 2013, 19:26:05 (11 years ago)
Author:
Henrik Bettermann
Message:

Introduce low_jamb_score property attribute. course2 is only editable if low_jamb_score is True.

Browser tests will follow.

Location:
main/waeup.futminna/trunk/src/waeup/futminna/applicants
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.futminna/trunk/src/waeup/futminna/applicants/applicant.py

    r10146 r10206  
    4242    grok.provides(ICustomApplicant)
    4343
     44    @property
     45    def low_jamb_score(self):
     46        jamb_score = getattr(self, 'jamb_score', None)
     47        course1 = getattr(self, 'course1', None)
     48        limit = getattr(course1, 'custom_float_1', None)
     49        if None in (jamb_score, limit):
     50            return False
     51        if jamb_score < limit:
     52            return True
     53        return False
     54
    4455# Set all attributes of CustomApplicant required in ICustomApplicant as field
    4556# properties. Doing this, we do not have to set initial attributes
  • main/waeup.futminna/trunk/src/waeup/futminna/applicants/browser.py

    r10105 r10206  
    3838    PG_OMIT_PDF_FIELDS,
    3939    PG_OMIT_MANAGE_FIELDS,
    40     PG_OMIT_EDIT_FIELDS,
     40    PUTME_OMIT_EDIT_FIELDS,
     41    PUTME_OMIT_DISPLAY_FIELDS,
     42    PUTME_OMIT_PDF_FIELDS,
     43    PUTME_OMIT_MANAGE_FIELDS,
     44    PUTME_OMIT_EDIT_FIELDS,
    4145    )
    4246from waeup.futminna.interfaces import MessageFactory as _
     
    113117        if not getattr(self.context, 'screening_date'):
    114118            form_fields = form_fields.omit('screening_date')
     119        if not self.context.low_jamb_score:
     120            form_fields = form_fields.omit('course2')
    115121        return form_fields
    116122
     
    130136            for field in PG_OMIT_PDF_FIELDS:
    131137                form_fields = form_fields.omit(field)
     138        elif target is not None and target.startswith('putme'):
     139            form_fields = grok.AutoFields(ICustomUGApplicant)
     140            if self._reduced_slip():
     141                for field in PUTME_OMIT_RESULT_SLIP_FIELDS:
     142                    form_fields = form_fields.omit(field)
    132143        else:
    133144            form_fields = grok.AutoFields(ICustomUGApplicant)
     
    142153        if not getattr(self.context, 'screening_date'):
    143154            form_fields = form_fields.omit('screening_date')
     155        if not self.context.low_jamb_score:
     156            form_fields = form_fields.omit('course2')
    144157        return form_fields
    145158
     
    155168            form_fields = grok.AutoFields(ICustomPGApplicant)
    156169            for field in PG_OMIT_MANAGE_FIELDS:
     170                form_fields = form_fields.omit(field)
     171        elif target is not None and target.startswith('putme'):
     172            form_fields = grok.AutoFields(ICustomUGApplicant)
     173            for field in PUTME_OMIT_MANAGE_FIELDS:
    157174                form_fields = form_fields.omit(field)
    158175        else:
     
    199216            for field in PG_OMIT_EDIT_FIELDS:
    200217                form_fields = form_fields.omit(field)
     218        elif target is not None and target.startswith('putme'):
     219            form_fields = grok.AutoFields(ICustomUGApplicantEdit)
     220            for field in PUTME_OMIT_EDIT_FIELDS:
     221                form_fields = form_fields.omit(field)
    201222        else:
    202223            form_fields = grok.AutoFields(ICustomUGApplicantEdit)
     
    205226        form_fields['applicant_id'].for_display = True
    206227        form_fields['reg_number'].for_display = True
     228        if not self.context.low_jamb_score:
     229            form_fields = form_fields.omit('course2')
    207230        return form_fields
    208231
Note: See TracChangeset for help on using the changeset viewer.