Ignore:
Timestamp:
9 May 2012, 22:34:42 (13 years ago)
Author:
Henrik Bettermann
Message:

Implement search page for applicants. Add fullname to applicants_catalog.
Plugins must be updated and /reindex?ctlg=applicants must be performed.

Tests will follow.

Rename ApplicantCatalog? to ApplicantsCatalog?. This does not affect persistent data.

Rename StudentIndexes? to StudentsCatalog?.

Add more localization.

File:
1 edited

Legend:

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

    r8383 r8404  
    2020from cStringIO import StringIO
    2121from grok import index
     22from hurry.query import Eq, Text
     23from hurry.query.query import Query
    2224from zope.component import getUtility, createObject, getAdapter
    2325from zope.component.interfaces import IFactory
     
    3739from waeup.kofa.applicants.interfaces import IApplicant, IApplicantEdit
    3840from waeup.kofa.applicants.workflow import application_states_dict
     41
     42def search(query=None, searchtype=None, view=None):
     43    if searchtype in ('fullname',):
     44        results = Query().searchResults(
     45            Text(('applicants_catalog', searchtype), query))
     46    else:
     47        results = Query().searchResults(
     48            Eq(('applicants_catalog', searchtype), query))
     49    return results
    3950
    4051class Applicant(grok.Container):
     
    157168Applicant = attrs_to_fields(Applicant)
    158169
    159 class ApplicantCatalog(grok.Indexes):
     170class ApplicantsCatalog(grok.Indexes):
    160171    """A catalog indexing :class:`Applicant` instances in the ZODB.
    161172    """
     
    164175    grok.context(IApplicant)
    165176
    166     #access_code = index.Field(attribute='access_code')
     177    fullname = index.Text(attribute='display_fullname')
    167178    applicant_id = index.Field(attribute='applicant_id')
    168179    reg_number = index.Field(attribute='reg_number')
Note: See TracChangeset for help on using the changeset viewer.