Changeset 6255


Ignore:
Timestamp:
31 May 2011, 07:41:11 (14 years ago)
Author:
Henrik Bettermann
Message:

Implement choice field for entry_session.

Scores must be integers.

File:
1 edited

Legend:

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

    r6254 r6255  
    7777    *sorted([(x[1],x[0]) for x in LGAS]))
    7878
     79def year_range():
     80    curr_year = datetime.now().year
     81    return range(curr_year - 2, curr_year + 5)
     82
     83def entry_sessions():
     84    curr_year = datetime.now().year
     85    year_range = range(curr_year - 5, curr_year + 2)
     86    return [('%s/%s' % (year,year+1), '%s' % year) for year in year_range]
     87
     88entry_session_vocab = SimpleWAeUPVocabulary(*entry_sessions())
     89
    7990class CertificateSource(BasicContextualSourceFactory):
    8091    """A certificate source delivers all certificates provided
     
    107118                    key=lambda value: value.code)
    108119
    109 def year_range():
    110     curr_year = datetime.now().year
    111     return range(curr_year - 2, curr_year + 5)
    112 
    113120class GenderSource(BasicSourceFactory):
    114121    """A gender source delivers basically a mapping
     
    431438        readonly = True,
    432439        )
    433     screening_score = schema.TextLine(
     440    screening_score = schema.Int(
    434441        title = u'Screening Score',
    435442        required = False,
     
    445452        required = False,
    446453        )
    447     entry_session = schema.TextLine(
    448         # XXX: should be choice
     454    entry_session = schema.Choice(
     455        source = entry_session_vocab,
    449456        title = u'Entry Session',
    450457        required = False,
     
    475482    omit fields. This has to be done in the respective form page.
    476483    """
    477     screening_score = schema.TextLine(
     484    screening_score = schema.Int(
    478485        title = u'Screening Score',
    479486        required = False,
Note: See TracChangeset for help on using the changeset viewer.