Ignore:
Timestamp:
18 Jun 2019, 05:47:35 (6 years ago)
Author:
Henrik Bettermann
Message:

course1 works only on manage pages. On edit pages course1 input is missing
and no Invalid exception is raised.
NoInputData?: NoInputD...course1'
Therefore, we check and compare course1 on CustomApplicantEditFormPage?.

Location:
main/waeup.aaue/trunk/src/waeup/aaue/applicants
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/applicants/browser.py

    r15276 r15459  
    547547            self.emit_lock_message()
    548548            return
     549        if getattr(
     550            self.context.course1, 'code', 'nocourse') == self.request.form.get(
     551            'form.course2', None):
     552            self.flash(_('2nd choice course must differ from 1st choice course.'),
     553                       type='danger')
     554            self.redirect(self.url(self.context))
     555            return
     556        if getattr(
     557            self.context.course1, 'code', 'nocourse') == self.request.form.get(
     558            'form.course3', None):
     559            self.flash(_('3rd choice course must differ from 1st choice course.'),
     560                       type='danger')
     561            self.redirect(self.url(self.context))
     562            return
    549563        super(CustomApplicantEditFormPage, self).update()
    550564        upload_stateresult = self.request.form.get('form.stateresult', None)
  • main/waeup.aaue/trunk/src/waeup/aaue/applicants/interfaces.py

    r15455 r15459  
    875875        )
    876876
     877    # course1 works only on manage pages. On edit pages course1 input is missing
     878    # and no Invalid exception is raised.
     879    # NoInputData: NoInputD...course1'
     880    # Therefore, we check and compare course1 on CustomApplicantEditFormPage.
     881    @invariant
     882    def course_choice(applicant):
     883        if applicant.course2 == applicant.course3:
     884            raise Invalid(_("3rd choice course must differ from 2nd choice course."))
     885
    877886#ICustomUGApplicantEdit['programme_type'].order = ICustomUGApplicant[
    878887#    'programme_type'].order
Note: See TracChangeset for help on using the changeset viewer.