Ignore:
Timestamp:
24 Aug 2015, 06:34:28 (9 years ago)
Author:
Henrik Bettermann
Message:

Add pre-fill UI components.

Take unused records first during self-registration.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/container.py

    r13077 r13217  
    2727from zope.component.factory import Factory
    2828from zope.component.interfaces import IFactory
     29from zope.catalog.interfaces import ICatalog
    2930from waeup.kofa.interfaces import MessageFactory as _
    3031from waeup.kofa.applicants.interfaces import (
     
    6768            applicant.applicant_id = applicant_id
    6869        self[applicant.application_number] = applicant
     70        return
     71
     72    @property
     73    def counts(self):
     74        total = len(self)
     75        code = self.code + '+'
     76        cat = getUtility(ICatalog, name='applicants_catalog')
     77        results = list(
     78           cat.searchResults(container_code=(code, code)))
     79        return len(self), len(results)
     80
     81    @property
     82    def first_unused(self):
     83        code = self.code + '-'
     84        cat = getUtility(ICatalog, name='applicants_catalog')
     85        results = list(
     86           cat.searchResults(container_code=(code, code)))
     87        if results:
     88            return results[0]
    6989        return
    7090
Note: See TracChangeset for help on using the changeset viewer.