Changeset 5088 for main/waeup.sirp/trunk/src/waeup/sirp
- Timestamp:
- 26 Mar 2010, 11:50:36 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/browser.py
r5084 r5088 2 2 """ 3 3 import grok 4 from datetime import datetime 4 5 from waeup.sirp.browser import WAeUPPage, WAeUPAddFormPage 5 6 from waeup.sirp.browser.breadcrumbs import Breadcrumb … … 7 8 from waeup.sirp.interfaces import IWAeUPObject 8 9 9 from waeup.sirp.accesscodes.interfaces import IAccessCodeBatchContainer 10 from waeup.sirp.accesscodes.accesscodes import AccessCodeBatch 11 from waeup.sirp.accesscodes.interfaces import ( 12 IAccessCodeBatchContainer, IAccessCodeBatch, 13 ) 10 14 11 15 grok.context(IWAeUPObject) … … 26 30 pnav = 0 27 31 32 form_fields = grok.AutoFields(IAccessCodeBatch).select( 33 'batch_prefix', 'entry_num', 'cost') 34 35 @grok.action('Cancel') 36 def cancel(self): 37 self.flash('Batch creation cancelled.') 38 self.redirect(self.url(self.context)) 39 28 40 @grok.action('Create batch') 29 41 def createBatch(self, **data): 30 self.flash('Batch created') 42 creator = self.request.principal.id 43 creation_date = datetime.now() 44 data.update(creation_date=creation_date, creator=creator) 45 batch = AccessCodeBatch(**data) 46 self.context.addBatch(batch) 47 self.context._p_changed = True 48 self.flash('Batch created (%s entries)' % data['entry_num']) 31 49 self.redirect(self.url(self.context)) 32 50
Note: See TracChangeset for help on using the changeset viewer.