Changeset 6956 for main/waeup.sirp/trunk/src/waeup
- Timestamp:
- 26 Oct 2011, 10:47:02 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/hostels
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/hostels/browser.py
r6954 r6956 32 32 from waeup.sirp.browser.resources import toggleall 33 33 from waeup.sirp.authentication import get_principal_role_manager 34 from waeup.sirp.students.browser import msave35 34 from waeup.sirp.hostels.container import HostelsContainer 36 35 from waeup.sirp.hostels.hostel import Hostel 37 36 from waeup.sirp.hostels.interfaces import IHostelsContainer, IHostel 38 37 38 def write_log_message(view, message): 39 ob_class = view.__implemented__.__name__.replace('waeup.sirp.','') 40 view.context.loggerInfo(ob_class, message) 41 return 42 43 # Save function used for save methods in manager pages 44 def msave(view, **data): 45 form = view.request.form 46 changed_fields = view.applyData(view.context, **data) 47 # Turn list of lists into single list 48 if changed_fields: 49 changed_fields = reduce(lambda x,y: x+y, changed_fields.values()) 50 fields_string = ' + '.join(changed_fields) 51 view.context._p_changed = True 52 view.flash('Form has been saved.') 53 if fields_string: 54 write_log_message(view, 'saved: % s' % fields_string) 55 return 39 56 40 57 class HostelsTab(PrimaryNavTab): … … 118 135 hostel = Hostel() 119 136 self.applyData(hostel, **data) 137 hostel.hostel_id = data['hostel_name'].lower().replace(' ','_') 120 138 self.context.addHostel(hostel) 121 139 self.flash('Hostel created.') … … 132 150 pnav = 5 133 151 134 #@property135 #def label(self):136 # return self.context.name152 @property 153 def label(self): 154 return self.context.hostel_name 137 155 138 #@property139 #def title(self):140 # return self.title156 @property 157 def title(self): 158 return self.context.hostel_name 141 159 142 160 class HostelManageActionButton(ManageActionButton): … … 159 177 pnav = 5 160 178 161 #@property162 #def title(self):163 # return self.context.name179 @property 180 def title(self): 181 return self.context.hostel_name 164 182 165 183 def update(self): -
main/waeup.sirp/trunk/src/waeup/sirp/hostels/container.py
r6953 r6956 20 20 from grok import index 21 21 from waeup.sirp.hostels.interfaces import IHostelsContainer, IHostel 22 from waeup.sirp.utils.helpers import attrs_to_fields 22 from waeup.sirp.utils.helpers import attrs_to_fields, get_current_principal 23 23 from waeup.sirp.utils.logger import Logger 24 24 -
main/waeup.sirp/trunk/src/waeup/sirp/hostels/interfaces.py
r6954 r6956 19 19 """ 20 20 21 #hostel_id = Attribute('Hostel Id') 22 21 23 hostel_id = schema.TextLine( 22 title = u'Hostel ID', 24 title = u'Hostel Id', 25 readonly = True, 26 ) 27 28 sort_id = schema.Int( 29 title = u'Sort Id', 30 required = True, 31 default = 10, 32 ) 33 34 hostel_name = schema.TextLine( 35 title = u'Hall Name', 23 36 required = True, 24 37 default = u'hostel_1', 25 38 ) 39 40 nr_of_blocks = schema.Int( 41 title = u'Number of Blocks', 42 required = True, 43 default = 3, 44 ) 45 46 nr_of_floors = schema.Int( 47 title = u'Number of Blocks', 48 required = True, 49 default = 3, 50 ) 51 52 rooms_per_floor = schema.Int( 53 title = u'Number of Blocks', 54 required = True, 55 default = 20, 56 ) 57 58 beds_per_room = schema.Int( 59 title = u'Number of Blocks', 60 required = True, 61 default = 6, 62 ) 63
Note: See TracChangeset for help on using the changeset viewer.