Ignore:
Timestamp:
27 Apr 2023, 11:37:37 (17 months ago)
Author:
Henrik Bettermann
Message:

Allow students to update their ship data from the personal page.

Add boolean field to indicate interest in NYSC.

Location:
main/waeup.uniben/trunk/src/waeup/uniben/students
Files:
7 edited

Legend:

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

    r17362 r17395  
    7676    ICustomStudentPersonalEdit,
    7777    IMedicalHistory,
     78    ITiship,
    7879    ICustomCourseTicket)
    7980from waeup.uniben.students.deplinks import DEPLINKS
     
    462463    """
    463464
    464     form_fields = grok.AutoFields(ICustomStudentPersonal)
     465    form_fields = grok.AutoFields(ICustomStudentPersonal) + grok.AutoFields(ITiship)
    465466    form_fields['perm_address'].custom_widget = BytesDisplayWidget
    466467    form_fields['next_kin_address'].custom_widget = BytesDisplayWidget
     
    473474    """
    474475
    475     form_fields = grok.AutoFields(ICustomStudentPersonal)
     476    form_fields = grok.AutoFields(ICustomStudentPersonal) + grok.AutoFields(ITiship)
    476477    form_fields['personal_updated'].for_display = True
    477478    form_fields[
     
    481482    """ Page to edit personal data
    482483    """
    483     form_fields = grok.AutoFields(
    484         ICustomStudentPersonalEdit).omit('personal_updated')
     484
     485    @property
     486    def form_fields(self):
     487        form_fields = grok.AutoFields(
     488            ICustomStudentPersonalEdit).omit('personal_updated') + grok.AutoFields(ITiship)
     489        studycourse = self.context['studycourse']
     490        certificate = getattr(studycourse,'certificate',None)
     491        current_level = studycourse.current_level
     492        end_level = certificate.end_level
     493        if not self.context.current_level >= end_level:
     494            form_fields = form_fields.omit('nysc')
     495        return form_fields
    485496
    486497class StudyCourseCOEditFormPage(KofaEditFormPage):
     
    852863    @property
    853864    def form_fields(self):
    854         form_fields = grok.AutoFields(IMedicalHistory)
     865        form_fields = grok.AutoFields(IMedicalHistory) + grok.AutoFields(ITiship)
    855866        form_fields['medical_updated'].for_display = True
    856867        for field in ('fever', 'headaches', 'catarrh', 'cough', 'sore_throat',
     
    929940    grok.require('waeup.viewStudent')
    930941    prefix = 'form'
    931     form_fields = grok.AutoFields(IMedicalHistory).select(
    932         'genotype', 'bloodgroup')
     942    form_fields = grok.AutoFields(ITiship)
    933943    title = ''
    934944
  • main/waeup.uniben/trunk/src/waeup/uniben/students/export.py

    r16837 r17395  
    148148            IMedicalHistory, exclude_attribs=False,))) + (
    149149            'student_id','display_fullname', 'matric_number', 'faccode',
    150             'depcode', 'state','current_session', 'current_level')
     150            'depcode', 'state','current_session', 'current_level', 'genotype', 'bloodgroup')
    151151    title = 'Medical Questionnaire Data'
    152152
     
    161161                'matric_number', 'faccode',
    162162                'depcode', 'state','current_session',
    163                 'current_level') and student is not None:
     163                'current_level',
     164                'genotype', 'bloodgroup') and student is not None:
    164165                value = getattr(student, name, None)
    165166        return super(
  • main/waeup.uniben/trunk/src/waeup/uniben/students/interfaces.py

    r17255 r17395  
    215215        )
    216216
    217 
    218     # Tiship form
     217class ITiship(IKofaObject):
     218    """Student tiship data.
     219    """
    219220
    220221    genotype = schema.TextLine(
     
    238239        )
    239240
     241    nysc = schema.Bool(
     242        title = _(u'Applying for NYSC'),
     243        default = False,
     244        required = True,
     245        )
     246
    240247class ICustomStudentPersonalEdit(INigeriaStudentPersonalEdit):
    241248    """Interface for editing personal data by students.
     
    248255        )
    249256
     257    nysc = schema.Bool(
     258        title = _(u'Do you want to apply for NYSC?'),
     259        default = False,
     260        description = u'Ensure that all your school charges are paid up to date to your graduating session before making this nysc application.',
     261        required = True,
     262        )
     263
    250264class ICustomUGStudentClearance(INigeriaUGStudentClearance):
    251265    """Representation of ug student clearance data.
     
    257271
    258272class ICustomStudent(ICustomStudentBase, ICustomUGStudentClearance,
    259     ICustomPGStudentClearance, ICustomStudentPersonal, IMedicalHistory):
     273    ICustomPGStudentClearance, ICustomStudentPersonal, IMedicalHistory,
     274    ITiship):
    260275    """Representation of a student.
    261276    """
  • main/waeup.uniben/trunk/src/waeup/uniben/students/student.py

    r16824 r17395  
    2929from kofacustom.nigeria.students.student import NigeriaStudent
    3030from waeup.uniben.students.interfaces import (
    31     ICustomStudent, ICustomStudentPersonalEdit, IMedicalHistory)
     31    ICustomStudent, ICustomStudentPersonalEdit, IMedicalHistory, ITiship)
    3232
    3333
     
    3838    grok.implements(
    3939        ICustomStudent, IStudentNavigation, ICustomStudentPersonalEdit,
    40         IMedicalHistory)
     40        IMedicalHistory, ITiship)
    4141    grok.provides(ICustomStudent)
    4242
  • main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py

    r17298 r17395  
    12261226        self.browser.getControl(name="form.genotype").value = 'XYZ'
    12271227        self.browser.getControl("Save").click()
     1228        self.browser.getLink("Base Data").click()
    12281229        self.browser.getLink("Download TISHIP registration slip").click()
    12291230        self.assertEqual(self.browser.headers['Status'], '200 Ok')
  • main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_export.py

    r17257 r17395  
    141141        result = open(self.outfile, 'rb').read()
    142142        self.assertMatches(
    143             'asthma,bloodgroup,body_pains,breathing,catarrh,company_confirmed,'
    144             'company_suspected,cough,diabetes,fever,genotype,headaches,hypertension,'
     143            'asthma,body_pains,breathing,catarrh,company_confirmed,'
     144            'company_suspected,cough,diabetes,fever,headaches,hypertension,'
    145145            'lagos_abuja,medical_updated,medicines,negative,obesity,'
    146146            'others,outside,positive,smell,sneezing,sore_throat,taste,'
    147147            'vaccination,weakness,student_id,display_fullname,'
    148148            'matric_number,faccode,depcode,state,current_session,'
    149             'current_level\r\n'
    150             ',,,,,,,,,,,,,,,,,,,,,,,1,,,,A111111,Anna M. Tester,234,'
    151             'NA,NA,created,2012,200\r\n' , result
     149            'current_level,genotype,bloodgroup\r\n'
     150            ',,,,,,,,,,,,,,,,,,,,,1,,,,A111111,Anna M. Tester,234,'
     151            'NA,NA,created,2012,200,,\r\n' , result
    152152            )
    153153        return
  • main/waeup.uniben/trunk/src/waeup/uniben/students/viewlets.py

    r17255 r17395  
    209209    grok.order(2)
    210210    grok.context(ICustomStudent)
    211     grok.view(StudentMedicalHistoryEditFormPage)
     211    grok.view(StudentBaseDisplayFormPage)
    212212    grok.require('waeup.viewStudent')
    213213    icon = 'actionicon_pdf.png'
Note: See TracChangeset for help on using the changeset viewer.