Changeset 14981 for main/waeup.aaue/trunk/src/waeup
- Timestamp:
- 5 Apr 2018, 06:26:47 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py
r14944 r14981 19 19 import csv 20 20 import textwrap 21 import pytz 21 22 from cStringIO import StringIO 23 from datetime import datetime 22 24 from zope.i18n import translate 23 25 from zope.component import getUtility, queryUtility … … 26 28 from zope.catalog.interfaces import ICatalog 27 29 from zope.formlib.textwidgets import BytesDisplayWidget 30 from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState 28 31 from waeup.kofa.browser.layout import UtilityView 29 32 from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget … … 52 55 DownloadScoresView, 53 56 StudentRequestPasswordPage, 54 StudyCourseManageFormPage 57 StudyCourseManageFormPage, 58 UnregisterCoursesView 55 59 ) 56 60 from kofacustom.nigeria.students.browser import ( … … 390 394 form_fields['imported_cgpa'].for_display = True 391 395 return form_fields 396 397 class CustomUnregisterCoursesView(UnregisterCoursesView): 398 """Unregister course list by student 399 """ 400 grok.context(ICustomStudentStudyLevel) 401 402 def update(self): 403 if not self.context.__parent__.is_current: 404 emit_lock_message(self) 405 return 406 try: 407 deadline = grok.getSite()['configuration'][ 408 str(self.context.level_session)].coursereg_deadline 409 except (TypeError, KeyError): 410 deadline = None 411 # In AAUE fresh students are allowed to "unregister their course" 412 # aside the deadline 413 if deadline and not self.context.student.is_fresh \ 414 and deadline < datetime.now(pytz.utc): 415 self.flash(_( 416 "Course registration has ended. " 417 "Unregistration is disabled."), type="warning") 418 elif str(self.context.__parent__.current_level) != self.context.__name__: 419 self.flash(_('This is not your current level.'), type="danger") 420 elif self.context.student.state == REGISTERED: 421 IWorkflowInfo(self.context.student).fireTransition('reset7') 422 message = _('Course list has been unregistered.') 423 self.flash(message) 424 else: 425 self.flash(_('You are in the wrong state.'), type="warning") 426 self.redirect(self.url(self.context)) 427 return 392 428 393 429 class CustomStudyLevelDisplayFormPage(StudyLevelDisplayFormPage):
Note: See TracChangeset for help on using the changeset viewer.