Changeset 7344 for main/waeup.sirp/trunk/src/waeup
- Timestamp:
- 14 Dec 2011, 14:06:24 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 2 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/applicant.py
r7341 r7344 80 80 81 81 def createStudent(self): 82 """Create a student object based on the applicant base data 83 and copy applicant object. 84 """ 82 """Create a student, fill with base data, create a StudentApplication 83 object and copy applicant data. 84 """ 85 # Is applicant in the correct state? 86 if self.state != 'admitted': 87 return False, "Applicant has not yet been admitted." 88 # Does registration number exist? 85 89 student = createObject(u'waeup.Student') 86 # Check first if registration number exists87 90 try: 88 91 student.reg_number = self.reg_number 89 92 except RegNumNotInSource: 90 93 return False, 'Registration Number exists.' 91 catalog = getUtility(ICatalog, name='certificates_catalog') 92 #import pdb; pdb.set_trace() 93 code = self.course_admitted['code'] 94 # Has the course_admitted field been properly filled? 95 code = self.course_admitted.get('code') 94 96 if code: 97 catalog = getUtility(ICatalog, name='certificates_catalog') 95 98 cert = [i for i in catalog.searchResults(code=(code,code))][0] 96 99 else: 97 100 return False, 'No course admitted provided.' 101 # Add student object 98 102 site = grok.getSite() 99 103 site['students'].addStudent(student) 104 # Fill student_id 105 self.student_id = student.student_id 106 # Fire transition 'create' 107 IWorkflowInfo(self).fireTransition('create') 108 100 109 # TODO: Split fullname in students package and copy first, 101 # middle and lastaname 102 110 # middle and lastname 111 112 # Copy some base data 103 113 student.fullname = self.fullname 104 114 student.sex = self.sex … … 106 116 student.email = self.email 107 117 student.phone = self.phone 118 # Save the certificate 108 119 student['studycourse'].certificate = cert 120 # Create StudentApplication object ... 121 application = createObject(u'waeup.StudentApplication') 122 # ... copy applicant base data 109 123 form_fields = grok.AutoFields(IApplicantBaseData) 110 124 field_names = [i.__name__ for i in form_fields] 111 application = createObject(u'waeup.StudentApplication')112 125 for name in field_names: 113 126 value = getattr(self,name,None) … … 115 128 setattr(application,name,value) 116 129 site['students'][student.student_id]['application'] = application 117 return True, 'Student with Id%s created' % student.student_id130 return True, 'Student %s created' % student.student_id 118 131 119 132 # Set all attributes of Applicant required in IApplicant as field -
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r7340 r7344 483 483 grok.require('waeup.viewStudent') 484 484 form_fields = grok.AutoFields(IApplicantBaseData) 485 form_fields['date_of_birth'].custom_widget = FriendlyDateDisplayWidget('le') 485 486 title = 'Application Data' 486 487 pnav = 4
Note: See TracChangeset for help on using the changeset viewer.