Changeset 7338 for main/waeup.sirp
- Timestamp:
- 13 Dec 2011, 17:26:35 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/applicants
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/applicant.py
r7321 r7338 20 20 from grok import index 21 21 from zope.component.interfaces import IFactory 22 from zope.component import createObject 22 23 from zope.securitypolicy.interfaces import IPrincipalRoleManager 23 24 from zope.interface import implementedBy … … 75 76 else: 76 77 return '%s %s' % (self.firstname, self.lastname) 78 79 def createStudent(self): 80 """Create a student object from applicatnt data 81 and copy applicant object. 82 """ 83 student = createObject(u'waeup.Student') 84 site = grok.getSite() 85 86 site['students'].addStudent(student) 87 student.fullname = self.fullname 88 return student.student_id 77 89 78 90 # Set all attributes of Applicant required in IApplicant as field -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py
r7331 r7338 282 282 the derived interfaces below, which set more fields to required 283 283 state, depending on use-case. 284 """ 284 285 This base interface is also implemented by the StudentApplication 286 class in the students package. Thus, these are the data which are saved 287 after admission. 288 """ 289 290 applicant_id = schema.TextLine( 291 title = u'Applicant Id', 292 required = False, 293 readonly = False, 294 ) 295 reg_number = TextLineChoice( 296 title = u'JAMB Registration Number', 297 readonly = False, 298 required = True, 299 default = None, 300 source = contextual_reg_num_source, 301 ) 302 access_code = schema.TextLine( 303 title = u'Access Code', 304 required = False, 305 readonly = True, 306 ) 307 firstname = schema.TextLine( 308 title = u'First Name', 309 required = True, 310 ) 311 middlenames = schema.TextLine( 312 title = u'Middle Names', 313 required = False, 314 ) 315 lastname = schema.TextLine( 316 title = u'Last Name (Surname)', 317 required = True, 318 ) 319 date_of_birth = schema.Date( 320 title = u'Date of Birth', 321 required = True, 322 ) 323 lga = schema.Choice( 324 source = lgas_vocab, 325 title = u'State/LGA', 326 default = 'foreigner', 327 required = True, 328 ) 329 sex = schema.Choice( 330 title = u'Sex', 331 source = GenderSource(), 332 default = u'm', 333 required = True, 334 ) 335 email = schema.ASCIILine( 336 title = u'Email', 337 required = True, 338 constraint=validate_email, 339 ) 340 phone = schema.TextLine( 341 title = u'Phone', 342 description = u'', 343 required = False, 344 ) 345 course1 = schema.Choice( 346 title = u'1st Choice Course of Study', 347 source = CertificateSource(), 348 required = True, 349 ) 350 course2 = schema.Choice( 351 title = u'2nd Choice Course of Study', 352 source = CertificateSource(), 353 required = False, 354 ) 355 356 # 357 # Data to be imported after screening 358 # 359 screening_score = schema.Int( 360 title = u'Screening Score', 361 required = False, 362 ) 363 screening_venue = schema.TextLine( 364 title = u'Screening Venue', 365 required = False, 366 ) 367 course_admitted = schema.Choice( 368 title = u'Admitted Course of Study', 369 source = CertificateSource(), 370 default = None, 371 required = False, 372 ) 373 notice = schema.Text( 374 title = u'Notice', 375 required = False, 376 ) 377 378 class IApplicantProcessData(IApplicantBaseData): 379 """An applicant. 380 381 Here we add process attributes and methods to the base data. 382 """ 383 285 384 history = Attribute('Object history, a list of messages.') 286 385 state = Attribute('The application state of an applicant') … … 294 393 """ 295 394 296 applicant_id = schema.TextLine(297 title = u'Applicant Id',298 required = False,299 readonly = False,300 )301 reg_number = TextLineChoice(302 title = u'JAMB Registration Number',303 readonly = False,304 required = True,305 default = None,306 source = contextual_reg_num_source,307 )308 access_code = schema.TextLine(309 title = u'Access Code',310 required = False,311 readonly = True,312 )313 firstname = schema.TextLine(314 title = u'First Name',315 required = True,316 )317 middlenames = schema.TextLine(318 title = u'Middle Names',319 required = False,320 )321 lastname = schema.TextLine(322 title = u'Last Name (Surname)',323 required = True,324 )325 date_of_birth = schema.Date(326 title = u'Date of Birth',327 required = True,328 )329 lga = schema.Choice(330 source = lgas_vocab,331 title = u'State/LGA',332 default = 'foreigner',333 required = True,334 )335 sex = schema.Choice(336 title = u'Sex',337 source = GenderSource(),338 default = u'm',339 required = True,340 )341 email = schema.ASCIILine(342 title = u'Email',343 required = True,344 constraint=validate_email,345 )346 phone = schema.TextLine(347 title = u'Phone',348 description = u'',349 required = False,350 )351 course1 = schema.Choice(352 title = u'1st Choice Course of Study',353 source = CertificateSource(),354 required = True,355 )356 course2 = schema.Choice(357 title = u'2nd Choice Course of Study',358 source = CertificateSource(),359 required = False,360 )361 362 #363 # Process Data364 #365 screening_score = schema.Int(366 title = u'Screening Score',367 required = False,368 )369 screening_venue = schema.TextLine(370 title = u'Screening Venue',371 required = False,372 )373 course_admitted = schema.Choice(374 title = u'Admitted Course of Study',375 source = CertificateSource(),376 default = None,377 required = False,378 )379 notice = schema.Text(380 title = u'Notice',381 required = False,382 )383 395 student_id = schema.TextLine( 384 396 title = u'Student Id', … … 391 403 ) 392 404 393 class IApplicant(IApplicant BaseData):405 class IApplicant(IApplicantProcessData): 394 406 """An applicant. 395 407 … … 399 411 """ 400 412 401 class IApplicantEdit(IApplicant BaseData):413 class IApplicantEdit(IApplicantProcessData): 402 414 """An applicant. 403 415 … … 443 455 readonly = True, 444 456 ) 457 458 def createStudent(): 459 """Create a student object from applicatnt data 460 and copy applicant object. 461 """ 445 462 446 463 class IApplicantUpdateByRegNo(IApplicant):
Note: See TracChangeset for help on using the changeset viewer.