- Timestamp:
- 14 Apr 2011, 08:07:37 (14 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/applicants
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/applicants.py
r5911 r5941 43 43 44 44 fst_sit_results = FieldProperty(IApplicant['fst_sit_results']) 45 locked = False 45 46 46 47 def __init__(self): -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py
r5937 r5941 351 351 grok.name('index') 352 352 grok.require('waeup.viewApplication') 353 form_fields = grok.AutoFields(IApplicant) 353 form_fields = grok.AutoFields(IApplicant).omit('locked') 354 354 form_fields['fst_sit_results'].custom_widget = list_results_display_widget 355 355 #form_fields['passport'].custom_widget = PassportDisplayWidget … … 364 364 grok.name('edit') 365 365 grok.require('waeup.editApplication') 366 form_fields = grok.AutoFields(IApplicantPDEEditData) 366 form_fields = grok.AutoFields(IApplicantPDEEditData).omit('locked') 367 367 #form_fields['passport'].custom_widget = FileWidget 368 368 #form_fields['passport'].custom_widget = PassportWidget … … 370 370 grok.template('form_edit_pde') 371 371 372 def emitLockMessage(self): 373 self.flash('The requested form is locked (read-only)') 374 self.redirect(self.url(self.context)) 375 return 376 372 377 def update(self): 378 if self.context.locked: 379 self.emitLockMessage() 380 return 373 381 super(EditApplicant, self).update() 374 print self.request.form375 382 return 376 383 … … 384 391 @grok.action('Save') 385 392 def save(self, **data): 393 if self.context.locked: 394 self.emitLockMessage() 395 return 386 396 self.applyData(self.context, **data) 387 397 self.context._p_changed = True … … 390 400 @grok.action('Final Submit') 391 401 def finalsubmit(self, **data): 402 if self.context.locked: 403 self.emitLockMessage() 404 return 392 405 self.applyData(self.context, **data) 393 406 self.context._p_changed = True 394 # XXX: Lock the form for editing... 395 return 407 if not self.dataComplete(): 408 self.flash('Data yet not complete.') 409 return 410 self.context.locked = True 411 return 412 413 def dataComplete(self): 414 if self.request.form.get('confirm', False) is False: 415 return False 416 if len(self.errors) > 0: 417 return False 418 return True -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py
r5907 r5941 454 454 required attributes set to True (which is the default). 455 455 """ 456 locked = schema.Bool( 457 title = u'Form locked', 458 default = False, 459 readonly = True, 460 ) 456 461 access_code = schema.TextLine( 457 462 title = u'Access Code', … … 558 563 """The data set presented to PDE applicants. 559 564 """ 565 locked = schema.Bool( 566 title = u'Form locked', 567 default = False, 568 readonly = True, 569 ) 560 570 reg_no = schema.TextLine( 561 571 title = u'JAMB Registration Number',
Note: See TracChangeset for help on using the changeset viewer.