Changeset 14304 for main/waeup.aaue/trunk/src/waeup
- Timestamp:
- 2 Dec 2016, 10:34:05 (8 years ago)
- Location:
- main/waeup.aaue/trunk/src/waeup/aaue/applicants
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/applicants/applicant.py
r14270 r14304 24 24 from waeup.aaue.applicants.interfaces import( 25 25 ICustomApplicant, ICustomUGApplicantEdit, ICustomPGApplicantEdit, 26 IPUTMEApplicantEdit, ITranscriptApplicant )26 IPUTMEApplicantEdit, ITranscriptApplicant, ICertificateRequest) 27 27 28 28 class CustomApplicant(NigeriaApplicant): 29 29 30 30 grok.implements(ICustomApplicant, ICustomUGApplicantEdit, 31 ICustomPGApplicantEdit, IPUTMEApplicantEdit, ITranscriptApplicant) 31 ICustomPGApplicantEdit, IPUTMEApplicantEdit, 32 ITranscriptApplicant, ICertificateRequest) 32 33 grok.provides(ICustomApplicant) 33 34 -
main/waeup.aaue/trunk/src/waeup/aaue/applicants/browser.py
r14228 r14304 49 49 ICustomUGApplicantEdit, 50 50 ITranscriptApplicant, 51 ICertificateRequest, 51 52 ICustomApplicant 52 53 ) … … 230 231 form_fields['perm_address'].custom_widget = BytesDisplayWidget 231 232 return form_fields 233 if self.target is not None and self.target == 'cert': 234 form_fields = grok.AutoFields(ICertificateRequest).omit( 235 'locked', 'suspended') 236 form_fields['dispatch_address'].custom_widget = BytesDisplayWidget 237 form_fields['perm_address'].custom_widget = BytesDisplayWidget 238 return form_fields 232 239 # AAUE is using the same interface for all regular applications. 233 240 form_fields = grok.AutoFields(ICustomUGApplicant) … … 261 268 def target_url(self): 262 269 if self.context.state in ('initialized', 'started', 'paid') \ 263 or self.context.special or self.view.target == 'trans':270 or self.context.special or self.view.target in ('trans', 'cert'): 264 271 return 265 272 return self.view.url(self.view.context, self.target) … … 337 344 form_fields['applicant_id'].for_display = True 338 345 return form_fields 346 if self.target is not None and self.target == 'cert': 347 form_fields = grok.AutoFields(ICertificateRequest) 348 form_fields['applicant_id'].for_display = True 349 return form_fields 339 350 # AAUE is using the same interface for all regular applications. 340 351 form_fields = grok.AutoFields(ICustomUGApplicant) … … 358 369 """An applicant-centered edit view for applicant data. 359 370 """ 360 361 grok.template('applicanteditpage')362 371 363 372 def unremovable(self, ticket): … … 388 397 if self.target is not None and self.target == 'trans': 389 398 form_fields = grok.AutoFields(ITranscriptApplicant).omit( 399 'locked', 'suspended') 400 form_fields['applicant_id'].for_display = True 401 return form_fields 402 if self.target is not None and self.target == 'cert': 403 form_fields = grok.AutoFields(ICertificateRequest).omit( 390 404 'locked', 'suspended') 391 405 form_fields['applicant_id'].for_display = True -
main/waeup.aaue/trunk/src/waeup/aaue/applicants/browser_templates/applicantdisplaypage.pt
r14303 r14304 15 15 </div> 16 16 17 <img src="" height="180px" tal:attributes="src view/passport_url" /> 17 <img tal:condition="python: not view.target in ('trans', 'cert')" 18 src="" height="180px" tal:attributes="src view/passport_url" /> 18 19 19 20 <table i18n:domain="waeup.kofa" class="form-table"> -
main/waeup.aaue/trunk/src/waeup/aaue/applicants/browser_templates/applicanteditpage.pt
r14029 r14304 22 22 <tbody> 23 23 <tal:widgets content="structure provider:widgets" /> 24 <tr >24 <tr tal:condition="python: not view.target in ('trans', 'cert')"> 25 25 <td class="fieldname" i18n:translate=""> 26 26 Passport Photo: … … 69 69 </table> 70 70 71 <div tal:condition="python: not view.manage_applications and not view.target == 'trans'">71 <div tal:condition="python: not view.manage_applications and not view.target in ('trans', 'cert')"> 72 72 <input id="confirm_passport" name="confirm_passport" 73 73 type="checkbox" value="True"/> … … 82 82 </span> 83 83 </div> 84 <div tal:condition="python: not view.manage_applications and view.target == 'trans'">84 <div tal:condition="python: not view.manage_applications and view.target in ('trans', 'cert')"> 85 85 <input id="confirm_passport" name="confirm_passport" 86 86 type="checkbox" value="True"/> -
main/waeup.aaue/trunk/src/waeup/aaue/applicants/export.py
r13980 r14304 25 25 INigeriaUGApplicant, INigeriaPGApplicant) 26 26 from waeup.aaue.applicants.interfaces import ( 27 ICustomUGApplicant, ITranscriptApplicant )27 ICustomUGApplicant, ITranscriptApplicant, ICertificateRequest) 28 28 29 29 class CustomApplicantExporter(NigeriaApplicantExporter): … … 36 36 iface_names(INigeriaPGApplicant) + 37 37 iface_names(IApplicantBaseData) + 38 iface_names(ITranscriptApplicant) 38 iface_names(ITranscriptApplicant) + 39 iface_names(ICertificateRequest) 39 40 ))) + ( 40 41 'password', 'state', 'history', 'container_code', 'application_number', -
main/waeup.aaue/trunk/src/waeup/aaue/applicants/interfaces.py
r14028 r14304 607 607 ) 608 608 609 class ICertificateRequest(IKofaObject): 610 """A transcript applicant. 611 """ 612 613 suspended = schema.Bool( 614 title = _(u'Account suspended'), 615 default = False, 616 required = False, 617 ) 618 619 locked = schema.Bool( 620 title = _(u'Form locked'), 621 default = False, 622 required = False, 623 ) 624 625 applicant_id = schema.TextLine( 626 title = _(u'Applicant Id'), 627 required = False, 628 readonly = False, 629 ) 630 631 firstname = schema.TextLine( 632 title = _(u'First Name'), 633 required = True, 634 ) 635 636 middlename = schema.TextLine( 637 title = _(u'Middle Name'), 638 required = False, 639 ) 640 641 lastname = schema.TextLine( 642 title = _(u'Last Name (Surname)'), 643 required = True, 644 ) 645 646 matric_number = schema.TextLine( 647 title = _(u'Matriculation Number'), 648 readonly = False, 649 required = False, 650 ) 651 652 date_of_birth = FormattedDate( 653 title = _(u'Date of Birth'), 654 required = False, 655 #date_format = u'%d/%m/%Y', # Use grok-instance-wide default 656 show_year = True, 657 ) 658 659 place_of_birth = schema.TextLine( 660 title = _(u'Place of Birth'), 661 readonly = False, 662 required = False, 663 ) 664 665 nationality = schema.Choice( 666 vocabulary = nats_vocab, 667 title = _(u'Nationality'), 668 required = False, 669 ) 670 671 email = schema.ASCIILine( 672 title = _(u'Email Address'), 673 required = True, 674 constraint=validate_email, 675 ) 676 677 phone = PhoneNumber( 678 title = _(u'Phone'), 679 description = u'', 680 required = False, 681 ) 682 683 perm_address = schema.Text( 684 title = _(u'Current Local Address'), 685 required = False, 686 readonly = False, 687 ) 688 689 dispatch_address = schema.Text( 690 title = _(u'Dispatch Address'), 691 description = u'Address to which certificate should be posted.', 692 required = False, 693 readonly = False, 694 ) 695 696 entry_session = schema.Choice( 697 title = _(u'Entry Session'), 698 source = academic_sessions_vocab, 699 required = False, 700 readonly = False, 701 ) 702 703 end_session = schema.Choice( 704 title = _(u'End Session'), 705 source = academic_sessions_vocab, 706 required = False, 707 readonly = False, 708 ) 709 710 course_studied = schema.Choice( 711 title = _(u'Course of Study / Degree'), 712 source = CertificateSource(), 713 required = False, 714 readonly = False, 715 ) 609 716 610 717 class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant, 611 ITranscriptApplicant ):718 ITranscriptApplicant, ICertificateRequest): 612 719 """An interface for all three types of applicants. 613 720 -
main/waeup.aaue/trunk/src/waeup/aaue/applicants/tests/test_browser.py
r14228 r14304 142 142 self.assertTrue("Dispatch Address" in self.browser.contents) 143 143 144 def test_certificate_request_manage(self): 145 # Add cert applicants container 146 self.certcontainer = ApplicantsContainer() 147 self.certcontainer.mode = 'create' 148 self.certcontainer.code = u'cert%s' % session_1 149 self.certcontainer.prefix = u'cert' 150 self.certcontainer.application_category = u'no' 151 self.certcontainer.year = session_1 152 self.certcontainer.application_fee = 300.0 153 self.certcontainer.title = u'This is the cert%s container' % session_1 154 self.app['applicants'][self.certcontainer.code] = self.certcontainer 155 delta = datetime.timedelta(days=10) 156 self.certcontainer.startdate = datetime.datetime.now(pytz.utc) - delta 157 self.certcontainer.enddate = datetime.datetime.now(pytz.utc) + delta 158 # Add applicant 159 certapplicant = createObject(u'waeup.Applicant') 160 certapplicant.firstname = u'Anna' 161 certapplicant.lastname = u'Post' 162 self.app['applicants'][self.certcontainer.code].addApplicant(certapplicant) 163 self.certapplication_number = certapplicant.application_number 164 self.certapplicant = self.app['applicants'][self.certcontainer.code][ 165 self.certapplication_number] 166 self.certapplicant_path = ('http://localhost/app/applicants/cert%s/%s' 167 % (session_1, self.certapplication_number)) 168 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 169 self.browser.open(self.certapplicant_path) 170 self.assertEqual(self.browser.headers['Status'], '200 Ok') 171 self.assertTrue("Dispatch Address" in self.browser.contents) 172 144 173 def test_pg_application_manage(self): 145 174 # Add pg applicants container -
main/waeup.aaue/trunk/src/waeup/aaue/applicants/utils.py
r13967 r14304 36 36 'pgpt': ['Postgraduate Part-Time Programmes', 'PG'], 37 37 'trans': ['Transcript Application', 'TR'], 38 'cert': ['Certificate Request', 'CR'], 38 39 'ioedp': ['Institute of Education Diploma Programmes', 'IOE'], 39 40 }
Note: See TracChangeset for help on using the changeset viewer.