## $Id: browser.py 8932 2012-07-07 10:48:31Z henrik $ ## ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## """UI components for basic applicants and related components. """ import grok from kofacustom.nigeria.applicants.browser import NigeriaApplicantEditFormPage from waeup.futminna.applicants.interfaces import ( ICustomPGApplicantEdit, ICustomUGApplicantEdit, IPUTMEApplicantEdit, UG_OMIT_EDIT_FIELDS, PG_OMIT_EDIT_FIELDS, PUTME_OMIT_EDIT_FIELDS, ) class CustomApplicantEditFormPage(NigeriaApplicantEditFormPage): """An applicant-centered edit view for applicant data. """ @property def form_fields(self): target = getattr(self.context.__parent__, 'prefix', None) if target is not None and target.startswith('pg'): form_fields = grok.AutoFields(ICustomPGApplicantEdit) for field in PG_OMIT_EDIT_FIELDS: form_fields = form_fields.omit(field) elif target is not None and target.startswith('putme'): form_fields = grok.AutoFields(IPUTMEApplicantEdit) for field in PUTME_OMIT_EDIT_FIELDS: form_fields = form_fields.omit(field) else: form_fields = grok.AutoFields(ICustomUGApplicantEdit) for field in UG_OMIT_EDIT_FIELDS: form_fields = form_fields.omit(field) form_fields['applicant_id'].for_display = True form_fields['reg_number'].for_display = True return form_fields