Changeset 6103 for main/waeup.sirp/trunk
- Timestamp:
- 15 May 2011, 02:51:49 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py
r6087 r6103 34 34 WAeUPDisplayFormPage, NullValidator) 35 35 from waeup.sirp.browser.breadcrumbs import Breadcrumb 36 from waeup.sirp.browser.layout import NullValidator 36 37 from waeup.sirp.browser.resources import datepicker, tabs, datatable 37 38 from waeup.sirp.browser.viewlets import ManageActionButton, PrimaryNavTab … … 140 141 pnav = 3 141 142 142 form_fields = grok.AutoFields(IApplicantsContainerAdd) 143 form_fields = grok.AutoFields( 144 IApplicantsContainerAdd).omit('code').omit('title') 143 145 form_fields['startdate'].custom_widget = FriendlyDateWidget('le') 144 146 form_fields['enddate'].custom_widget = FriendlyDateWidget('le') … … 146 148 def update(self): 147 149 datepicker.need() # Enable jQuery datepicker in date fields. 150 from waeup.sirp.browser.resources import jqueryui 151 jqueryui.need() 148 152 return super(ApplicantsContainerAddFormPage, self).update() 149 153 150 154 @grok.action('Add applicants container') 151 155 def addApplicantsContainer(self, **data): 152 year 1 = unicode(data['year'])153 year2 = unicode(data['year']+1)154 code = unicode(data['prefix']) + year1155 title = u nicode(application_types_vocab.getTerm(data['prefix']).title) + u' ' + year1 + u'/' + year2156 year = data['year'] 157 code = u'%s%s' % (data['prefix'], year) 158 prefix = application_types_vocab.getTerm(data['prefix']) 159 title = u'%s %s/%s' % (prefix.title, year, year + 1) 156 160 if code in self.context.keys(): 157 self.status = Invalid('The code chosen already exists ' 158 'in the database') 161 self.status = Invalid( 162 'Error: An applicants container for the same application ' 163 'type and entrance year exists already in the database') 159 164 return 160 165 # Add new applicants container... … … 164 169 container.code = code 165 170 container.title = title 166 #import pdb; pdb.set_trace()167 171 self.context[code] = container 168 172 self.flash('Added "%s".' % code) … … 170 174 return 171 175 172 @grok.action('Cancel' )176 @grok.action('Cancel', validator=NullValidator) 173 177 def cancel(self, **data): 174 self.redirect(self.url(self.context ))178 self.redirect(self.url(self.context, '@@manage') + '#tab-1') 175 179 176 180 class ApplicantsRootBreadcrumb(Breadcrumb):
Note: See TracChangeset for help on using the changeset viewer.