Changeset 7525


Ignore:
Timestamp:
27 Jan 2012, 18:24:31 (13 years ago)
Author:
Henrik Bettermann
Message:

Add more fields to student interfaces. Use these interfaces also for import.

Location:
main/waeup.custom/trunk/src/waeup/custom/students
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.custom/trunk/src/waeup/custom/students/browser.py

    r7505 r7525  
    1818import grok
    1919from zope.formlib.textwidgets import BytesDisplayWidget
    20 from waeup.custom.students.interfaces import IStudent, IStudentPersonal
    21 from waeup.sirp.students.browser import StudentPersonalDisplayFormPage
     20from waeup.sirp.widgets.datewidget import (
     21    FriendlyDateWidget, FriendlyDateDisplayWidget
     22    )
     23from waeup.custom.students.interfaces import (
     24    IStudent, IStudentPersonal, IStudentClearance, IStudentClearanceEdit
     25    )
     26from waeup.sirp.students.browser import (
     27    StudentPersonalDisplayFormPage, StudentPersonalManageFormPage,
     28    StudentClearanceManageFormPage, StudentClearanceEditFormPage,
     29    StudentClearanceDisplayFormPage
     30    )
    2231
    2332class StudentPersonalDisplayFormPage(StudentPersonalDisplayFormPage):
     
    2837    form_fields['perm_address'].custom_widget = BytesDisplayWidget
    2938
     39class StudentPersonalManageFormPage(StudentPersonalManageFormPage):
     40    """ Page to edit student clearance data
     41    """
     42    grok.context(IStudent)
     43    form_fields = grok.AutoFields(IStudentPersonal)
    3044
     45class StudentClearanceDisplayFormPage(StudentClearanceDisplayFormPage):
     46    """ Page to display student clearance data
     47    """
     48    grok.context(IStudent)
     49    form_fields = grok.AutoFields(IStudentClearance).omit('clearance_locked')
     50    form_fields['date_of_birth'].custom_widget = FriendlyDateDisplayWidget('le')
     51
     52class StudentClearanceManageFormPage(StudentClearanceManageFormPage):
     53    """ Page to edit student clearance data
     54    """
     55    grok.context(IStudent)
     56    form_fields = grok.AutoFields(IStudentClearance)
     57    form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year')
     58
     59class StudentClearanceEditFormPage(StudentClearanceEditFormPage):
     60    """ View to edit student clearance data by student
     61    """
     62    grok.context(IStudent)
     63    form_fields = grok.AutoFields(
     64        IStudentClearanceEdit).omit('clearance_locked')
     65    form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year')
     66
     67
  • main/waeup.custom/trunk/src/waeup/custom/students/interfaces.py

    r7505 r7525  
    2121    IStudentBase,IStudentClearance,IStudentPersonal,IStudentNavigation,
    2222    )
     23from waeup.sirp.students.vocabularies import lgas_vocab, nats_vocab
    2324
    2425class IStudentPersonal(IStudentPersonal):
     
    4647    date_of_birth = schema.Date(
    4748        title = u'Date of Birth',
    48         required = True,
     49        required = False,
    4950        )
    5051
     
    5960        required = False,
    6061        readonly = True,
     62        )
     63
     64    nationality = schema.Choice(
     65        source = nats_vocab,
     66        title = u'Nationality',
     67        default = 'nigeria',
     68        required = False,
     69        )
     70
     71    lga = schema.Choice(
     72        source = lgas_vocab,
     73        title = u'State/LGA',
     74        required = False,
    6175        )
    6276
  • main/waeup.custom/trunk/src/waeup/custom/students/student.py

    r7505 r7525  
    4242# set.
    4343Student = attrs_to_fields(Student)
    44 
    45 class StudentFactory(StudentFactory):
    46     """A factory for students.
    47     """
    48 
    49     def __call__(self, *args, **kw):
    50         return Student()
    51 
    52     def getInterfaces(self):
    53         return implementedBy(Student)
Note: See TracChangeset for help on using the changeset viewer.