Changeset 10794 for main/kofacustom.ekodisco/trunk/src
- Timestamp:
- 23 Nov 2013, 08:24:15 (11 years ago)
- Location:
- main/kofacustom.ekodisco/trunk/src/kofacustom/ekodisco/applicants
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.ekodisco/trunk/src/kofacustom/ekodisco/applicants/applicant.py
r10770 r10794 21 21 from waeup.kofa.applicants.applicant import ApplicantFactory 22 22 from waeup.kofa.utils.helpers import attrs_to_fields 23 from kofacustom.nigeria.applicants.applicant import NigeriaApplicant23 from waeup.kofa.applicants.applicant import Applicant 24 24 from kofacustom.ekodisco.applicants.interfaces import( 25 ICustomApplicant, ICustom UGApplicantEdit, ICustomPGApplicantEdit, IPUTMEApplicantEdit)25 ICustomApplicant, ICustomApplicantEdit) 26 26 27 class CustomApplicant( NigeriaApplicant):27 class CustomApplicant(Applicant): 28 28 29 grok.implements(ICustomApplicant, ICustomUGApplicantEdit, 30 ICustomPGApplicantEdit, IPUTMEApplicantEdit) 29 grok.implements(ICustomApplicant, ICustomApplicantEdit) 31 30 grok.provides(ICustomApplicant) 32 31 -
main/kofacustom.ekodisco/trunk/src/kofacustom/ekodisco/applicants/browser.py
r10788 r10794 19 19 """ 20 20 import grok 21 from zope.formlib.textwidgets import BytesDisplayWidget 21 22 from waeup.kofa.applicants.browser import ( 22 23 ApplicantRegistrationPage, ApplicantsContainerPage) 23 from waeup.kofa.applicants.interfaces import IApplicant, IApplicantEdit 24 from kofacustom.ekodisco.applicants.interfaces import ( 25 ICustomApplicant, ICustomApplicantEdit) 24 26 from kofacustom.nigeria.applicants.browser import ( 25 27 NigeriaApplicantDisplayFormPage, … … 36 38 grok.template('applicantdisplaypage') 37 39 38 form_fields = grok.AutoFields(I Applicant).omit(40 form_fields = grok.AutoFields(ICustomApplicant).omit( 39 41 'locked', 'course_admitted', 'password', 'suspended', 40 'course2', 'notice', 'student_id') 42 'course2', 'notice', 'student_id', 'sex') 43 44 form_fields['perm_address'].custom_widget = BytesDisplayWidget 45 form_fields['service_address'].custom_widget = BytesDisplayWidget 41 46 42 47 class CustomApplicantManageFormPage(ApplicantManageFormPage): … … 45 50 grok.template('applicanteditpage') 46 51 47 form_fields = grok.AutoFields(IApplicant).omit('course2', 'notice', 'student_id') 52 form_fields = grok.AutoFields(ICustomApplicant).omit( 53 'course2', 'notice', 'student_id', 'sex') 48 54 form_fields['applicant_id'].for_display = True 49 55 … … 53 59 grok.template('applicanteditpage') 54 60 55 form_fields = grok.AutoFields(I ApplicantEdit).omit(61 form_fields = grok.AutoFields(ICustomApplicantEdit).omit( 56 62 'locked', 'course_admitted', 'student_id', 57 'suspended', 'course2', 'notice' 63 'suspended', 'course2', 'notice', 'sex' 58 64 ) 59 65 form_fields['applicant_id'].for_display = True -
main/kofacustom.ekodisco/trunk/src/kofacustom/ekodisco/applicants/interfaces.py
r10770 r10794 28 28 from waeup.kofa.schema import FormattedDate, TextLineChoice 29 29 from waeup.kofa.students.vocabularies import nats_vocab, GenderSource 30 from waeup.kofa.applicants.interfaces import contextual_reg_num_source 30 from waeup.kofa.applicants.interfaces import ( 31 contextual_reg_num_source, 32 IApplicant, IApplicantEdit, IApplicantUpdateByRegNo) 31 33 from kofacustom.nigeria.applicants.interfaces import ( 32 34 LGASource, high_qual, high_grade, exam_types, 33 INigeriaUGApplicant, INigeriaPGApplicant,34 35 INigeriaApplicantOnlinePayment, 35 INigeriaUGApplicantEdit, INigeriaPGApplicantEdit,36 INigeriaApplicantUpdateByRegNo,37 IPUTMEApplicantEdit,38 36 ) 39 37 from kofacustom.ekodisco.interfaces import MessageFactory as _ 40 38 from kofacustom.ekodisco.payments.interfaces import ICustomOnlinePayment 41 39 42 class ICustom UGApplicant(INigeriaUGApplicant):43 """An undergraduateapplicant.40 class ICustomApplicant(IApplicant): 41 """An applicant. 44 42 45 This interface defines the least common multiple of all fields46 in ug application forms. In customized forms, fields can be excluded by47 adding them to the UG_OMIT* tuples.48 43 """ 49 44 50 class ICustomPGApplicant(INigeriaPGApplicant): 51 """A postgraduate applicant. 45 course1 = schema.Choice( 46 title = _(u'Desired Contract'), 47 source = AppCatCertificateSource(), 48 required = False, 49 ) 50 course2 = schema.Choice( 51 title = _(u'Not applicable'), 52 source = AppCatCertificateSource(), 53 required = False, 54 ) 55 course_admitted = schema.Choice( 56 title = _(u'Assigned Contract'), 57 source = CertificateSource(), 58 required = False, 59 readonly = False, 60 ) 61 perm_address = schema.Text( 62 title = _(u'Customer Address'), 63 required = False, 64 ) 65 service_address = schema.Text( 66 title = _(u'Service Address'), 67 required = False, 68 ) 52 69 53 This interface defines the least common multiple of all fields 54 in pg application forms. In customized forms, fields can be excluded by 55 adding them to the PG_OMIT* tuples. 56 """ 57 58 59 class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant): 60 """An interface for both types of applicants. 61 62 Attention: The ICustomPGApplicant field seetings will be overwritten 63 by ICustomPGApplicant field settings. If a field is defined 64 in both interfaces zope.schema validates only against the 65 constraints in ICustomUGApplicant. This does not affect the forms 66 since they are build on either ICustomUGApplicant or ICustomPGApplicant. 67 """ 68 69 def writeLogMessage(view, comment): 70 """Adds an INFO message to the log file 71 """ 72 73 def createStudent(): 74 """Create a student object from applicant data 75 and copy applicant object. 76 """ 77 78 class ICustomUGApplicantEdit(INigeriaUGApplicantEdit): 79 """An undergraduate applicant interface for edit forms. 70 class ICustomApplicantEdit(IApplicantEdit): 71 """An applicant interface for edit forms. 80 72 81 73 Here we can repeat the fields from base data and set the … … 88 80 """ 89 81 90 class ICustomPGApplicantEdit(INigeriaPGApplicantEdit): 91 """A postgraduate applicant interface for editing. 92 93 Here we can repeat the fields from base data and set the 94 `required` and `readonly` attributes to True to further restrict 95 the data access. Or we can allow only certain certificates to be 96 selected by choosing the appropriate source. 97 98 We cannot omit fields here. This has to be done in the 99 respective form page. 100 """ 82 course1 = schema.Choice( 83 title = _(u'Desired Contract'), 84 source = AppCatCertificateSource(), 85 required = True, 86 ) 87 course2 = schema.Choice( 88 title = _(u'Not applicable'), 89 source = AppCatCertificateSource(), 90 required = False, 91 ) 92 course_admitted = schema.Choice( 93 title = _(u'Assigned Contract'), 94 source = CertificateSource(), 95 required = False, 96 readonly = True, 97 ) 98 perm_address = schema.Text( 99 title = _(u'Customer Address'), 100 required = True, 101 ) 102 service_address = schema.Text( 103 title = _(u'Service Address'), 104 required = True, 105 ) 101 106 102 107 class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment): … … 105 110 """ 106 111 107 class IPUTMEApplicantEdit(IPUTMEApplicantEdit): 108 """An undergraduate applicant interface for editing. 109 110 Here we can repeat the fields from base data and set the 111 `required` and `readonly` attributes to True to further restrict 112 the data access. Or we can allow only certain certificates to be 113 selected by choosing the appropriate source. 114 115 We cannot omit fields here. This has to be done in the 116 respective form page. 117 """ 118 119 class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo): 112 class ICustomApplicantUpdateByRegNo(IApplicantUpdateByRegNo): 120 113 """Representation of an applicant. 121 114
Note: See TracChangeset for help on using the changeset viewer.