Changeset 14886


Ignore:
Timestamp:
1 Nov 2017, 12:21:13 (7 years ago)
Author:
Henrik Bettermann
Message:

Add 'current_mode' to study course exporter fields.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/export.py

    r14716 r14886  
    1818"""Exporters for student related stuff.
    1919"""
     20from waeup.kofa.utils.batching import ExporterBase
    2021from kofacustom.dspg.students.interfaces import (
    2122    ICustomStudent,
     
    4647
    4748    fields = tuple(
    48         sorted(iface_names(ICustomStudentStudyCourse))) + ('student_id',)
     49        sorted(iface_names(ICustomStudentStudyCourse))) + (
     50            'student_id', 'current_mode')
     51
     52    def mangle_value(self, value, name, context=None):
     53        if name == 'certificate' and value is not None:
     54            value = value.code
     55        if name in ('student_id', 'current_mode') and context is not None:
     56            student = context.student
     57            value = getattr(student, name, None)
     58        return ExporterBase().mangle_value(value, name, context=context)
    4959
    5060class CustomStudentStudyLevelExporter(NigeriaStudentStudyLevelExporter):
Note: See TracChangeset for help on using the changeset viewer.