Ignore:
Timestamp:
18 Aug 2025, 06:25:21 (9 hours ago)
Author:
Henrik Bettermann
Message:

Implement tpu zone application.

File:
1 edited

Legend:

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

    r18067 r18156  
    4646from waeup.fceokene.applicants.schools_tpu import SCHOOLS_TPU
    4747from waeup.fceokene.applicants.schools_utp import SCHOOLS_UTP
     48from waeup.fceokene.applicants.zones import ZONES_TPU
    4849from waeup.fceokene.interfaces import MessageFactory as _
    4950
     
    9293            SCHOOLS_TPU[value][2],)
    9394
     95class TPUZoneSource(BasicSourceFactory):
     96    """A source that delivers all kinds of TPU zones.
     97    """
     98    def getValues(self):
     99        sorted_items = sorted(
     100            ZONES_TPU.items(),
     101            key=lambda element: int(element[1][0].split()[1]))
     102        return [item[0] for item in sorted_items]
     103
     104    def getToken(self, value):
     105        return value
     106
     107    def getTitle(self, value):
     108        if not ZONES_TPU.get(value, None):
     109            return u"none-existent"
     110        return u"%s: %s" % (
     111            ZONES_TPU[value][0],
     112            ZONES_TPU[value][1],)
     113
    94114class UTPSchoolSource(BasicSourceFactory):
    95115    """A source that delivers all kinds of UTP schools.
     
    192212        )
    193213
    194     school_tpu = schema.Choice(
    195         title = _(u'1st Choice TPZ and School'),
    196         source = TPUSchoolSource(),
     214    #school_tpu = schema.Choice(
     215    #    title = _(u'1st Choice TPZ and School'),
     216    #    source = TPUSchoolSource(),
     217    #    required = False,
     218    #    )
     219
     220    zone_tpu = schema.Choice(
     221        title = _(u'1st Choice TPZ'),
     222        source = TPUZoneSource(),
    197223        required = False,
    198224        )
Note: See TracChangeset for help on using the changeset viewer.