Ignore:
Timestamp:
24 May 2013, 05:18:59 (11 years ago)
Author:
Henrik Bettermann
Message:

Define invariant condition for managers.

Applicants can also see first choice course in edit form.

File:
1 edited

Legend:

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

    r10204 r10217  
    2020
    2121from zope import schema
     22from zope.interface import Attribute, invariant, Invalid
    2223from waeup.kofa.applicants.interfaces import (
    2324    IApplicantBaseData,
     
    4142    PUTME_OMIT_PDF_FIELDS,
    4243    PUTME_OMIT_MANAGE_FIELDS,
    43     PUTME_OMIT_EDIT_FIELDS,
     44    PUTME_OMIT_FIELDS,
     45    #PUTME_OMIT_EDIT_FIELDS,
    4446    )
     47
     48PUTME_OMIT_EDIT_FIELDS = UG_OMIT_EDIT_FIELDS + PUTME_OMIT_FIELDS + (
     49    'firstname', 'middlename', 'lastname', 'sex',
     50    'lga')
    4551
    4652PG_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + ('course2',)
     
    8389    course2 = schema.Choice(
    8490        title = _(u'2nd Choice Course of Study'),
    85         description = _(u'Comment which explains why applicant must select a 2nd Choice Course of Study.'),
    86         source = AppCatCertificateSource(),
    87         required = True,
     91        source = AppCatCertificateSource(),
     92        required = False,
    8893        )
    8994    hq_type = schema.Choice(
     
    167172        )
    168173
     174    @invariant
     175    def second_choice(applicant):
     176        if applicant.course1 == applicant.course2:
     177            raise Invalid(_("2nd choice course must differ from 1st choice course."))
    169178
    170179class ICustomPGApplicant(IApplicantBaseData):
     
    259268    """
    260269
     270    course1 = schema.Choice(
     271        title = _(u'1st Choice Course of Study'),
     272        source = AppCatCertificateSource(),
     273        required = True,
     274        readonly = True,
     275        )
     276
     277    course2 = schema.Choice(
     278        title = _(u'2nd Choice Course of Study'),
     279        description = _(u'Comment which explains why applicant must select a 2nd Choice Course of Study.'),
     280        source = AppCatCertificateSource(),
     281        required = True,
     282        )
     283
    261284class ICustomPGApplicantEdit(ICustomPGApplicant):
    262285    """A postgraduate applicant interface for editing.
Note: See TracChangeset for help on using the changeset viewer.