Changeset 9437 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 27 Oct 2012, 05:35:04 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r9428 r9437 43 43 from waeup.kofa.interfaces import ( 44 44 IKofaObject, IUserAccount, IExtFileStore, IPasswordValidator, IContactForm, 45 IKofaUtils, IUniversity, IObjectHistory )45 IKofaUtils, IUniversity, IObjectHistory, academic_sessions) 46 46 from waeup.kofa.interfaces import MessageFactory as _ 47 47 from waeup.kofa.widgets.datewidget import ( … … 878 878 yield(dict(code=code, title=title)) 879 879 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 880 888 @action(_('Add study level')) 881 889 def addStudyLevel(self, **data): 882 890 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 883 896 studylevel = createObject(u'waeup.StudentStudyLevel') 884 897 studylevel.level = int(level_code) 885 studylevel.level_session = self.context.current_session898 studylevel.level_session = int(level_session) 886 899 try: 887 900 self.context.addStudentStudyLevel( -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/studycoursemanagepage.pt
r7811 r9437 70 70 </span> 71 71 </span> 72 <select id="addlevel" name="addlevel" >72 <select id="addlevel" name="addlevel" class='span5'> 73 73 <option tal:attributes="value level/code" tal:repeat="level view/level_dict"> 74 74 <span tal:replace="level/title">LEVELTITLE 75 </span> 76 </option> 77 </select> 78 <span i18n:translate="">in session</span> 79 <select id="level_session" name="level_session" class='span3'> 80 <option tal:attributes="value session/code" tal:repeat="session view/session_dict"> 81 <span tal:replace="session/title">LEVELSESSION 75 82 </span> 76 83 </option> -
main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py
r9424 r9437 461 461 title = _(u'Session'), 462 462 source = academic_sessions_vocab, 463 required = False,463 required = True, 464 464 ) 465 465 -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r9424 r9437 674 674 self.browser.getControl(name="addlevel").value = ['100'] 675 675 self.browser.getControl("Add study level").click() 676 self.assertMatches( 677 '...You must select a session...', self.browser.contents) 678 self.browser.getControl(name="addlevel").value = ['100'] 679 self.browser.getControl(name="level_session").value = ['2004'] 680 self.browser.getControl("Add study level").click() 676 681 self.assertMatches('...<span>100</span>...', self.browser.contents) 677 682 self.assertEqual(self.student['studycourse']['100'].level, 100) 678 683 self.assertEqual(self.student['studycourse']['100'].level_session, 2004) 684 self.browser.getControl(name="addlevel").value = ['100'] 685 self.browser.getControl(name="level_session").value = ['2004'] 679 686 self.browser.getControl("Add study level").click() 680 687 self.assertMatches('...This level exists...', self.browser.contents) … … 683 690 '...No study level selected...', self.browser.contents) 684 691 self.browser.getControl(name="val_id").value = ['100'] 692 self.browser.getControl(name="level_session").value = ['2004'] 685 693 self.browser.getControl("Remove selected").click() 686 694 self.assertMatches('...Successfully removed...', self.browser.contents) … … 693 701 # Add level again 694 702 self.browser.getControl(name="addlevel").value = ['100'] 703 self.browser.getControl(name="level_session").value = ['2004'] 695 704 self.browser.getControl("Add study level").click() 696 705 … … 732 741 # Add next level 733 742 self.browser.getControl(name="addlevel").value = ['200'] 743 self.browser.getControl(name="level_session").value = ['2005'] 734 744 self.browser.getControl("Add study level").click() 735 745 self.browser.getLink("200").click()
Note: See TracChangeset for help on using the changeset viewer.