Ignore:
Timestamp:
1 Dec 2014, 16:13:12 (10 years ago)
Author:
Henrik Bettermann
Message:

Add date_of_invitation field.

Add ClearanceRequestedStudentExporter?. This exports students in state 'clearance_requested' and is mainly meant for reimporting invitation dates.

Tests will follow.

Location:
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/browser.py

    r11536 r12107  
    154154        if self.context.is_postgrad:
    155155            form_fields = grok.AutoFields(INigeriaPGStudentClearance).omit(
    156             'clearance_locked', 'nysc_location', 'clr_code', 'officer_comment')
     156            'clearance_locked', 'nysc_location', 'clr_code', 'officer_comment',
     157            'date_of_invitation')
    157158        else:
    158159            form_fields = grok.AutoFields(INigeriaUGStudentClearance).omit(
    159             'clearance_locked', 'clr_code', 'officer_comment')
     160            'clearance_locked', 'clr_code', 'officer_comment',
     161            'date_of_invitation')
    160162        return form_fields
    161163
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/export.py

    r12080 r12107  
    1818"""Exporters for student related stuff.
    1919"""
     20import grok
     21from waeup.kofa.interfaces import REQUESTED
    2022from kofacustom.nigeria.students.interfaces import (
    2123    INigeriaStudent,
     
    3133    StudentPaymentsExporter)
    3234from waeup.kofa.utils.helpers import iface_names
     35from kofacustom.nigeria.interfaces import MessageFactory as _
    3336
    3437class NigeriaStudentExporter(StudentExporter):
     
    8487            omit=['display_item']))) + (
    8588            'student_id','state','current_session')
     89
     90class ClearanceRequestedStudentExporter(StudentExporter):
     91    """Exporter of data used to assign dates of invitation
     92    """
     93
     94    grok.name('clearancerequested')
     95
     96    fields = ('student_id', 'reg_number', 'display_fullname',
     97              'state', 'current_session', 'history', 'date_of_invitation')
     98
     99    title = _(u'Clearance Invitation Data')
     100
     101    def filter_func(self, x, **kw):
     102        # We use this method to post-filter students in state
     103        # 'clearance_requested'
     104        return [student for student in x if student.state == REQUESTED]
     105
     106    def mangle_value(self, value, name, context=None):
     107        if name == 'history':
     108            # Only show last mesage
     109            value = value.messages[-1]
     110        return super(
     111            StudentExporter, self).mangle_value(
     112            value, name, context=context)
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/interfaces.py

    r10690 r12107  
    6868        )
    6969
     70    date_of_invitation= schema.TextLine(
     71        title = _(u"Date of Invitation"),
     72        required = False,
     73        )
     74
    7075    clearance_locked = schema.Bool(
    7176        title = _(u'Clearance form locked'),
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/tests/test_export.py

    r12080 r12107  
    4848        self.assertMatches(
    4949            'adm_code,alr_date,alr_fname,alr_no,alr_results,clearance_locked,'
    50             'clr_code,date_of_birth,def_adm,disabled,email,emp2_end,'
     50            'clr_code,date_of_birth,date_of_invitation,def_adm,disabled,email,emp2_end,'
    5151            'emp2_position,emp2_reason,emp2_start,emp_end,emp_position,'
    5252            'emp_reason,emp_start,employer,employer2,firstname,former_matric,'
     
    6363            'suspended,suspended_comment,password,state,history,certcode,is_postgrad,'
    6464            'current_level,current_session\r\nmy adm code,,,,'
    65             '"[(\'accounts\', \'A\')]",0,my clr code,1981-02-04#,,,'
     65            '"[(\'accounts\', \'A\')]",0,my clr code,1981-02-04#,,,,'
    6666            'anna@sample.com,,,,,,,,,,,Anna,,,,,"[(\'accounts\', \'A\')]"'
    6767            ',,,,,,,,,,,,,,,,Tester,,,234,M.,NG,,,,,,,,,'
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/utils.py

    r10687 r12107  
    6565        'form.former_matric': _(u'Former Student'),
    6666        }
     67
     68    STUDENT_EXPORTER_NAMES = StudentsUtils().STUDENT_EXPORTER_NAMES + (
     69            'clearancerequested',)
Note: See TracChangeset for help on using the changeset viewer.