- Timestamp:
- 6 Mar 2012, 03:31:52 (13 years ago)
- Location:
- main/waeup.sirp/branches/ulif-schoolgrades/src/waeup/sirp/applicants
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/branches/ulif-schoolgrades/src/waeup/sirp/applicants/applicant.py
r7686 r7761 37 37 from waeup.sirp.applicants.workflow import application_states_dict 38 38 39 from waeup.sirp.applicants.interfaces import IResultEntry 40 from zope.schema.fieldproperty import FieldProperty 41 class ResultEntry(grok.Model): 42 grok.implements(IResultEntry) 43 subject = FieldProperty(IResultEntry['subject']) 44 grade = FieldProperty(IResultEntry['grade']) 45 46 #def __init__(self, subject=None, grade=None): 47 # self.subject = subject 48 # self.grade = grade 49 39 50 class Applicant(grok.Container): 40 51 grok.implements(IApplicant,IApplicantEdit) -
main/waeup.sirp/branches/ulif-schoolgrades/src/waeup/sirp/applicants/browser.py
r7741 r7761 638 638 return True 639 639 640 from waeup.sirp.applicants.interfaces import IResultEntry 641 from waeup.sirp.widgets.objectwidget import SIRPObjectWidget 642 from waeup.sirp.applicants.applicant import ResultEntry 643 from zope.formlib.widget import CustomWidgetFactory 644 from zope.formlib.widgets import ListSequenceWidget 645 entry_widget = CustomWidgetFactory(SIRPObjectWidget, ResultEntry) 646 sw = CustomWidgetFactory(ListSequenceWidget, subwidget=entry_widget) 647 640 648 class ApplicantManageFormPage(SIRPEditFormPage): 641 649 """A full edit view for applicant data. … … 649 657 form_fields['applicant_id'].for_display = True 650 658 form_fields['phone'].custom_widget = PhoneWidget 659 form_fields['school_grades'].custom_widget = sw 651 660 grok.template('applicanteditpage') 652 661 manage_applications = True … … 780 789 form_fields['phone'].custom_widget = PhoneWidget 781 790 form_fields['applicant_id'].for_display = True 791 form_fields['school_grades'].custom_widget = sw 782 792 grok.template('applicanteditpage') 783 793 manage_applications = False -
main/waeup.sirp/branches/ulif-schoolgrades/src/waeup/sirp/applicants/interfaces.py
r7708 r7761 78 78 directlyProvides(contextual_reg_num_source, IContextSourceBinder) 79 79 80 SUBJECTS = dict(math=_(u'Math'), 81 bio=_(u'Biology'), 82 eng=_(u'English'), 83 ) 84 class SubjectSource(BasicSourceFactory): 85 def getValues(self): 86 return sorted(SUBJECTS.keys()) 87 def getTitle(self, value): 88 return SUBJECTS.get(value, None) 89 90 GRADES = {'A':_(u'Very Good'), 91 'B':_(u'Good'), 92 'C':_(u'Satisfactory'), 93 'D':_(u'Sufficient'), 94 'E':_(u'Fail'), 95 } 96 class GradeSource(BasicSourceFactory): 97 def getValues(self): 98 return sorted(GRADES.keys()) 99 def getTitle(self, value): 100 return GRADES.get(value, None) 101 80 102 class AppCatCertificateSource(CertificateSource): 81 103 """An application certificate source delivers all courses which belong to … … 352 374 'provider'].order = IApplicantsContainer['provider'].order 353 375 376 class IResultEntry(Interface): 377 subject = schema.Choice( 378 title = _(u'Subject'), 379 source = SubjectSource(), 380 ) 381 #subject = schema.TextLine( 382 # title = _(u'Subject'), 383 # ) 384 grade = schema.Choice( 385 title = _(u'Grafde'), 386 source = GradeSource(), 387 ) 388 #grade = schema.TextLine( 389 # title = _(u'Grade'), 390 # ) 391 354 392 class IApplicantBaseData(ISIRPObject): 355 393 """The data for an applicant. … … 360 398 state, depending on use-case. 361 399 362 This base interface is also implemented by the StudentApplication363 class in the students package. Thus, these are the data which are saved364 after admission.365 """366 400 This base interface is also implemented by the 401 :class:`waeup.sirp.students.StudentApplication` class in the 402 students package. Thus, these are the data which are saved after 403 admission. 404 """ 367 405 applicant_id = schema.TextLine( 368 406 title = _(u'Applicant Id'), … … 430 468 required = False, 431 469 ) 470 school_grades = schema.List( 471 title = _(u'School Grades'), 472 value_type = schema.Object( 473 schema = IResultEntry), 474 required = True, 475 default = [], 476 ) 477 #school_grades = schema.Dict( 478 # title = _(u'School Grades'), 479 # key_type = schema.TextLine( 480 # title = _(u'Subject'), 481 # ), 482 # value_type = schema.TextLine( 483 # title = _(u'Grade'), 484 # ) 485 # ) 432 486 433 487 #
Note: See TracChangeset for help on using the changeset viewer.