- Timestamp:
- 7 Jan 2010, 22:57:16 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-layout/src/waeup/browser/pages.py
r4707 r4711 12 12 from waeup.interfaces import (IUniversity, IWAeUPObject, IUserContainer, 13 13 IUserAccount, IFacultyContainer, IDataCenter, 14 IFaculty )14 IFaculty, IDepartment) 15 15 from waeup.widgets.interfaces import ITableProvider 16 16 from waeup.utils.helpers import getName … … 435 435 self.table = ITableProvider(self.context).getTables(view=self)[0] 436 436 self.table.need() 437 438 class AddDepartmentFormPage(WAeUPAddFormPage): 439 grok.context(IFaculty) 440 grok.name('add') 441 form_fields = grok.AutoFields(IDepartment) 442 title = 'Add a department' 443 pnav = 1 444 445 @grok.action('Add department') 446 def addDepartment(self, **data): 447 department = createObject(u'waeup.Department') 448 self.applyData(department, **data) 449 try: 450 self.context.addDepartment(department) 451 except DuplicationError: 452 self.status = Invalid('The name chosen already exists ' 453 'in the database') 454 return 455 self.redirect(self.url(self.context)) 456 457 class ManageDepartmentFormPage(WAeUPEditFormPage): 458 """Manage the basic properties of a `Faculty` instance. 459 """ 460 grok.context(IFaculty) 461 grok.name('manage') 462 form_fields = grok.AutoFields(IFaculty) 463 title = 'Edit faculty' 464 pnav = 1 465 466 @grok.action('Save') 467 def save(self, **data): 468 self.applyData(self.context, **data) 469 return 470 471 @grok.action('Save and return') 472 def saveAndReturn(self, **data): 473 self.applyData(self.context, **data) 474 self.redirect(self.url(self.context)) 475 return 476 477 @grok.action('Cancel') 478 def cancel(self, **data): 479 self.redirect(self.url(self.context)) 480 return
Note: See TracChangeset for help on using the changeset viewer.