def select(): # get a name of the pic card_idx = int(next(request.form.keys()).rstrip('.x')) game = get_game() game.revealed.append(card_idx) Event(card_idx, game.id) game.save() return redirect(url_for('play'))
def __init__(self, data): for key in data.keys(): setattr(self, key, data[key]) if data['lastEvent']: setattr(self, 'lastEvent', Event(data['lastEvent'])) if data['parameters']: setattr(self, 'parameters', [Parameter(parameter) for parameter in data['parameters']]) if data.get('serviceType'): setattr(self, 'serviceType', serviceType(data['serviceType'])) if data.get('ackTime'): self.isAcknowledged = True else: self.isAcknowledged = False
def create(): location = request.form.get('location') date = request.form.get('date') time = request.form.get('time') event_name = request.form.get('event_name') description = request.form.get('description') establishment_id = request.form.get('establishment_id') events = Event(location=location, date=date, time=time, event_name=event_name, description=description, establishment_id=establishment_id) try: events.save() flash('Event registered successfully', 'success') return redirect(url_for('events.index')) except: flash('Error creating event', 'danger') return redirect(url_for('events.new'))
def post(self): payload = request.get_data() json_data = json.loads(payload) event = Event( json_data.get("id"), json_data.get("userid"), json_data.get("noun"), datetime.datetime.now(), json_data.get("latlong"), json_data.get("verb"), json_data.get("timespent"), json_data.get("properties") ) xx = event.save() RulesEngine().execute(json_data) xx = json.dumps(event, cls=AlchemyEncoder) return {"response": json.loads(xx), "status": "success"}
Category(category="community"), Category(category="fashion"), Category(category="film"), Category(category="hobbies"), Category(category="government"), Category(category="science"), ] list_events = [ Event( name="Tupac Live at the Apollo!!", date="21st June", start_time="2pm", duration="1 day", description= "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.", target_age=30, expected_attendees=20000, location="Dubai", image= "https://images.unsplash.com/photo-1492684223066-81342ee5ff30?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80", user_id=1, category=list_categories), Event( name="Beyonce Live in Concert", date="21st June", start_time="2pm", duration="1 day", description= "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.", target_age=50, expected_attendees=40000,
def build_event(event): # Remove the "name" of the event since it's unused event.pop("name") e = {key: parse(value) for key, value in event.items()} return Event(lambda: evaluate(e.get('trigger')), lambda: do_event(e.get('action')))