Changeset 17313 for main/waeup.kofa/trunk/src/waeup/kofa/hostels/browser.py
- Timestamp:
- 25 Jan 2023, 08:52:51 (22 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/hostels/browser.py
r15633 r17313 266 266 grok.name('addhostel') 267 267 #grok.template('hosteladdpage') 268 form_fields = grok.AutoFields(IHostel).omit(' beds_reserved', 'hostel_id')268 form_fields = grok.AutoFields(IHostel).omit('hostel_id') 269 269 label = _('Add hostel') 270 270 pnav = 5 … … 294 294 grok.require('waeup.viewHostels') 295 295 grok.template('hostelpage') 296 form_fields = grok.AutoFields(IHostel) .omit('beds_reserved')296 form_fields = grok.AutoFields(IHostel) 297 297 pnav = 5 298 298 … … 315 315 grok.name('manage') 316 316 grok.require('waeup.manageHostels') 317 form_fields = grok.AutoFields(IHostel).omit('hostel_id' , 'beds_reserved')317 form_fields = grok.AutoFields(IHostel).omit('hostel_id') 318 318 grok.template('hostelmanagepage') 319 319 label = _('Manage hostel') … … 322 322 tabtwoactions = [_('Update all beds'), 323 323 _('Switch reservation of selected beds'), 324 _('Switch blockade of selected beds'), 324 325 _('Release selected beds'), 325 326 _('Clear hostel')] … … 337 338 338 339 @action(_('Update all beds'), style='primary', 339 warning=_('Attention: The updater removes all reservation flags of existing beds.' 340 ' You really want to update?')) 340 warning=_('Attention: The updater removes all reservation and ' 341 'blockade flags of existing beds. ' 342 'You really want to update?')) 341 343 def updateBeds(self, **data): 342 344 if not grok.getSite()['configuration'].maintmode_enabled_by: … … 364 366 return 365 367 366 @action(_('Switch reservation of selected beds')) 367 def switchReservations(self, **data): 368 def _switchBeds(self, switch_type): 368 369 form = self.request.form 369 370 if 'val_id' in form: … … 380 381 preferred_language = self.request.cookies.get('kofa.language') 381 382 for bed_id in child_id: 382 message = self.context[bed_id].switch Reservation()383 message = self.context[bed_id].switchBed(switch_type) 383 384 switched.append('%s (%s)' % (bed_id,message)) 384 385 m_translated = translate(message, 'waeup.kofa', … … 396 397 self.context.writeLogMessage(self, 'switched: %s' % message) 397 398 self.redirect(self.url(self.context, '@@manage')+'#tab2') 399 return 400 401 402 @action(_('Switch reservation of selected beds')) 403 def switchReservations(self, **data): 404 self._switchBeds('reserved') 405 return 406 407 @action(_('Switch blockade of selected beds')) 408 def switchBockade(self, **data): 409 self._switchBeds('blocked') 398 410 return 399 411 … … 456 468 457 469 def update(self): 470 if self.context.bed_type.endswith('blocked'): 471 # No student can reside in a blocked bed. 472 self.redirect(self.url(self.context.__parent__, '@@manage')+'#tab2') 458 473 if self.context.owner != NOT_OCCUPIED: 459 474 # Don't use this form for exchanging students.
Note: See TracChangeset for help on using the changeset viewer.