Changeset 9496 for main/waeup.aaue/trunk
- Timestamp:
- 1 Nov 2012, 08:35:49 (12 years ago)
- Location:
- main/waeup.aaue/trunk/src/waeup/aaue/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py
r8911 r9496 19 19 from zope.i18n import translate 20 20 from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget 21 from waeup.kofa.students.browser import CourseTicketAddFormPage 21 22 from kofacustom.nigeria.students.browser import ( 22 23 NigeriaOnlinePaymentDisplayFormPage, … … 24 25 NigeriaExportPDFPaymentSlipPage) 25 26 26 from waeup.aaue.students.interfaces import ICustomStudentOnlinePayment 27 from waeup.aaue.students.interfaces import ( 28 ICustomStudentOnlinePayment, ICustomCourseTicketAdd) 27 29 28 30 class CustomOnlinePaymentDisplayFormPage(NigeriaOnlinePaymentDisplayFormPage): … … 49 51 form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') 50 52 form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') 53 54 class CourseTicketAddFormPage2(CourseTicketAddFormPage): 55 """Add a course ticket by student. 56 """ 57 grok.name('ctadd') 58 grok.require('waeup.handleStudent') 59 form_fields = grok.AutoFields(ICustomCourseTicketAdd) -
main/waeup.aaue/trunk/src/waeup/aaue/students/interfaces.py
r9154 r9496 18 18 19 19 from zope import schema 20 from zc.sourcefactory.contextual import BasicContextualSourceFactory 21 from zope.catalog.interfaces import ICatalog 22 from zope.component import getUtility 23 from waeup.kofa.interfaces import IKofaObject 20 24 from kofacustom.nigeria.students.interfaces import ( 21 25 INigeriaStudentBase, INigeriaUGStudentClearance, INigeriaPGStudentClearance, … … 26 30 from waeup.aaue.payments.interfaces import ICustomOnlinePayment 27 31 from waeup.aaue.interfaces import MessageFactory as _ 32 33 class CourseSource(BasicContextualSourceFactory): 34 """A course source delivers all courses inside the portal by looking 35 up a catalog. 36 """ 37 def getValues(self, context): 38 catalog = getUtility(ICatalog, name='courses_catalog') 39 payments_folder = context.student['payments'] 40 payments = [(p.p_session, p.p_category, p.p_state) 41 for p in payments_folder.values()] 42 courses = sorted(list(catalog.searchResults( 43 code=(None, None))),key=lambda value: value.code) 44 if (context.student.current_session, 'schoolfee_2', 'paid') in payments: 45 pass 46 else: 47 courseslist = list(courses) 48 for course in courseslist: 49 if course.semester == 2: 50 courses.remove(course) 51 return courses 52 53 def getToken(self, context, value): 54 return value.code 55 56 def getTitle(self, context, value): 57 return "%s - %s (%d)" % ( 58 value.code, value.title[:64], value.semester) 28 59 29 60 class ICustomStudentBase(INigeriaStudentBase): … … 91 122 """ 92 123 124 class ICustomCourseTicketAdd(IKofaObject): 125 """An interface for adding course tickets. 126 127 """ 128 course = schema.Choice( 129 title = _(u'Course'), 130 source = CourseSource(), 131 readonly = False, 132 ) 133 93 134 class ICustomStudentUpdateByRegNo(INigeriaStudentUpdateByRegNo): 94 135 """Representation of a student. Skip regular reg_number validation.
Note: See TracChangeset for help on using the changeset viewer.