def _checkParams(self): defaults = FormDefaults(location=Location.default_location) self._form = SearchRoomsForm(self._get_form_data(), obj=defaults) if (not session.avatar or not session.avatar.has_rooms) and not hasattr( self, 'search_criteria'): # Remove the form element if the user has no rooms and we are not using a shortcut del self._form.is_only_my_rooms
def _process_args(self): defaults = FormDefaults(location=Location.default_location) self._form = SearchRoomsForm(self._get_form_data(), obj=defaults, csrf_enabled=False) if (not session.user or not Room.user_owns_rooms( session.user)) and not hasattr(self, 'search_criteria'): # Remove the form element if the user has no rooms and we are not using a shortcut del self._form.is_only_my_rooms
class RHRoomBookingSearchRooms(RHRoomBookingBase): menu_item = 'roomSearch' def _get_form_data(self): return request.form def _checkParams(self): defaults = FormDefaults(location=Location.default_location) self._form = SearchRoomsForm(self._get_form_data(), obj=defaults) if not session.user.has_rooms and not hasattr(self, 'search_criteria'): # Remove the form element if the user has no rooms and we are not using a shortcut del self._form.is_only_my_rooms def _is_submitted(self): return self._form.is_submitted() def _process(self): form = self._form if self._is_submitted() and form.validate(): rooms = Room.find_with_filters(form.data, session.user) return WPRoomBookingSearchRoomsResults(self, self.menu_item, rooms=rooms).display() equipment_locations = { eq.id: eq.location_id for eq in EquipmentType.find() } return WPRoomBookingSearchRooms( self, form=form, errors=form.error_list, rooms=Room.find_all(), equipment_locations=equipment_locations).display()
class RHRoomBookingSearchRooms(RHRoomBookingBase): menu_item = 'search_rooms' CSRF_ENABLED = False def _get_form_data(self): return request.form def _process_args(self): defaults = FormDefaults(location=Location.default_location) self._form = SearchRoomsForm(self._get_form_data(), obj=defaults, csrf_enabled=False) if (not session.user or not Room.user_owns_rooms(session.user)) and not hasattr(self, 'search_criteria'): # Remove the form element if the user has no rooms and we are not using a shortcut del self._form.is_only_my_rooms def _is_submitted(self): return self._form.is_submitted() def _process(self): form = self._form if self._is_submitted() and form.validate(): rooms = Room.find_with_filters(form.data, session.user) return WPRoomBookingSearchRoomsResults(self, self.menu_item, rooms=rooms).display() equipment_locations = {eq.id: eq.location_id for eq in EquipmentType.find()} return WPRoomBookingSearchRooms(self, form=form, errors=form.error_list, rooms=Room.find_all(is_active=True), equipment_locations=equipment_locations).display()
class RHRoomBookingSearchRooms(RHRoomBookingBase): menu_item = 'search_rooms' CSRF_ENABLED = False def _get_form_data(self): return request.form def _process_args(self): defaults = FormDefaults(location=Location.default_location) self._form = SearchRoomsForm(self._get_form_data(), obj=defaults, csrf_enabled=False) if (not session.user or not Room.user_owns_rooms( session.user)) and not hasattr(self, 'search_criteria'): # Remove the form element if the user has no rooms and we are not using a shortcut del self._form.is_only_my_rooms def _is_submitted(self): return self._form.is_submitted() def _process(self): form = self._form if self._is_submitted() and form.validate(): rooms = Room.find_with_filters(form.data, session.user) return WPRoomBookingSearchRoomsResults(self, self.menu_item, rooms=rooms).display() return WPRoomBookingSearchRooms( self, form=form, errors=form.error_list, rooms=Room.find_all(is_active=True)).display()
class RHRoomBookingSearchRooms(RHRoomBookingBase): menu_item = "roomSearch" def _get_form_data(self): return request.form def _checkParams(self): defaults = FormDefaults(location=Location.default_location) self._form = SearchRoomsForm(self._get_form_data(), obj=defaults) if not session.user.has_rooms and not hasattr(self, "search_criteria"): # Remove the form element if the user has no rooms and we are not using a shortcut del self._form.is_only_my_rooms def _is_submitted(self): return self._form.is_submitted() def _process(self): form = self._form if self._is_submitted() and form.validate(): rooms = Room.find_with_filters(form.data, session.user) return WPRoomBookingSearchRoomsResults(self, self.menu_item, rooms=rooms).display() equipment_locations = {eq.id: eq.location_id for eq in EquipmentType.find()} return WPRoomBookingSearchRooms( self, form=form, errors=form.error_list, rooms=Room.find_all(), equipment_locations=equipment_locations ).display()
def _checkParams(self): defaults = FormDefaults(location=Location.default_location) self._form = SearchRoomsForm(self._get_form_data(), obj=defaults) if not session.user.has_rooms and not hasattr(self, 'search_criteria'): # Remove the form element if the user has no rooms and we are not using a shortcut del self._form.is_only_my_rooms
def _process_args(self): defaults = FormDefaults(location=Location.default_location) self._form = SearchRoomsForm(self._get_form_data(), obj=defaults, csrf_enabled=False) if (not session.user or not Room.user_owns_rooms(session.user)) and not hasattr(self, 'search_criteria'): # Remove the form element if the user has no rooms and we are not using a shortcut del self._form.is_only_my_rooms