Ignore:
Timestamp:
27 Oct 2012, 05:35:04 (12 years ago)
Author:
Henrik Bettermann
Message:

Make level_session required and let officers select the right level_session when adding study levels.

File:
1 edited

Legend:

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

    r9428 r9437  
    4343from waeup.kofa.interfaces import (
    4444    IKofaObject, IUserAccount, IExtFileStore, IPasswordValidator, IContactForm,
    45     IKofaUtils, IUniversity, IObjectHistory)
     45    IKofaUtils, IUniversity, IObjectHistory, academic_sessions)
    4646from waeup.kofa.interfaces import MessageFactory as _
    4747from waeup.kofa.widgets.datewidget import (
     
    878878            yield(dict(code=code, title=title))
    879879
     880    @property
     881    def session_dict(self):
     882        yield(dict(code='', title='--'))
     883        for item in academic_sessions():
     884            code = item[1]
     885            title = item[0]
     886            yield(dict(code=code, title=title))
     887
    880888    @action(_('Add study level'))
    881889    def addStudyLevel(self, **data):
    882890        level_code = self.request.form.get('addlevel', None)
     891        level_session = self.request.form.get('level_session', None)
     892        if not level_session:
     893            self.flash(_('You must select a session for the level.'))
     894            self.redirect(self.url(self.context, u'@@manage')+'?tab2')
     895            return
    883896        studylevel = createObject(u'waeup.StudentStudyLevel')
    884897        studylevel.level = int(level_code)
    885         studylevel.level_session = self.context.current_session
     898        studylevel.level_session = int(level_session)
    886899        try:
    887900            self.context.addStudentStudyLevel(
Note: See TracChangeset for help on using the changeset viewer.