Ignore:
Timestamp:
6 Apr 2023, 17:46:36 (21 months ago)
Author:
Henrik Bettermann
Message:

Customize all certificate select boxes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/utils/utils.py

    r17140 r17377  
    203203        'cdl': 'Distance Learning',
    204204        }
     205
     206    def sortCertificates(self, context, resultset):
     207        """Sort already filtered certificates in `CertificateSource`.
     208        """
     209        resultlist = sorted(resultset, key=lambda
     210            value: value.__parent__.__parent__.__parent__.code +
     211            value.__parent__.__parent__.code +
     212            value.code)
     213        return resultlist
     214
     215    def getCertTitle(self, context, value):
     216        """Compose the titles in `CertificateSource`.
     217        """
     218        try: title = "%s / %s / %s (%s)" % (
     219            value.__parent__.__parent__.__parent__.title,
     220            value.__parent__.__parent__.title,
     221            value.title, value.code)
     222        except AttributeError:
     223            title = "NA / %s (%s)" % (value.title, value.code)
     224        return title
Note: See TracChangeset for help on using the changeset viewer.