def form_to_dao(self, business_id): business = None if business_id is not None and len(business_id) > 1: business = self.businessDao.get_record(long(business_id)) logger.debug('business ' + str(business)) else: business = Business() logger.debug('business 2 ' + str(business)) business.name = self.form.name.data #Create an automatic alias for the business business.alias = utils.slugify(self.form.name.data) business.description = self.form.description.data return cms_utils.form_to_dao_contact_info(self.form, business)
def form_to_dao(self, childevent_id): childevent = None if childevent_id is not None and len(childevent_id) > 1: childevent = self.childeventDao.get_record(long(childevent_id)) else: childevent = Event() childevent.name = self.form.name.data #Create an automatic alias for the childevent childevent.alias = utils.slugify(self.form.name.data) childevent.description = self.form.description.data childevent.start_datetime = self.form.start_datetime.data childevent.end_datetime = self.form.end_datetime.data childevent = cms_utils.form_to_dao_contact_info(self.form, childevent) return childevent
def form_to_dao(self, playground_id): playground = None if playground_id is not None and len(playground_id) > 1: playground = self.playgroundDao.get_record(long(playground_id)) else: playground = Playground() playground.name = self.form.name.data playground.sport = self.form.sport.data.lower() #Create an automatic alias for the playground playground.alias = utils.slugify(self.form.name.data) playground.description = self.form.description.data playground.featured = self.form.featured.data self.form.address.locality.data = self.form.locality.data #for locality from basic info to address self.form.address.city.data = self.form.city.data #for city from basic info to address playground = cms_utils.form_to_dao_address(self.form, playground) playground = cms_utils.form_to_dao_contact_info(self.form, playground) return playground
def form_to_dao(self, trainingcentre_id): trainingcentre = None if trainingcentre_id is not None and len(trainingcentre_id) > 1: trainingcentre = self.trainingCentreDao.get_record(long(trainingcentre_id)) else: trainingcentre = TrainingCentre() trainingcentre.name = self.form.name.data trainingcentre.sport = self.form.sport.data #Create an automatic alias for the trainingcentre trainingcentre.alias = utils.slugify(self.form.name.data) trainingcentre.description = self.form.description.data trainingcentre.featured = self.form.featured.data self.form.address.locality.data = self.form.locality.data #for locality from basic info to address self.form.address.city.data = self.form.city.data #for city from basic info to address trainingcentre = cms_utils.form_to_dao_address(self.form, trainingcentre) trainingcentre = cms_utils.form_to_dao_contact_info(self.form, trainingcentre) return trainingcentre
def form_to_dao(self, event_id): event = None if event_id is not None and len(event_id) > 1: event = self.eventDao.get_record(long(event_id)) else: event = Event() event.name = self.form.name.data event.sport = self.form.sport.data #Create an automatic alias for the event event.alias = utils.slugify(self.form.name.data) event.caption = self.form.caption.data event.description = self.form.description.data event.featured = self.form.featured.data event.start_datetime = datetime(*(self.form.start_datetime.data.timetuple()[:6])) event.end_datetime = datetime(*(self.form.end_datetime.data.timetuple()[:6])) self.form.address.city.data = self.form.city.data #for city from basic info to address event = cms_utils.form_to_dao_address(self.form, event) event = cms_utils.form_to_dao_contact_info(self.form, event) return event