def get(self): output_event = [] user = users.get_current_user() if not user: self.redirect(users.create_login_url(self.request.uri)) events = dal.get_events(None) for event in events: output_event.append( { "id": event.key().id(), "headline": event.headline, "active": event.active, "category": event.category, "description": event.description, "date": event.date_of_incident, "reach": event.reach, "how_to_help": event.how_to_help, "lat": event.location.lat, "lng": event.location.lon, "points": event.points.split("@"), } ) self.response.out.write(json.dumps(output_event))
def get(self): # Get the events event_objs = dal.get_events() # Locales locales = { 'title': 'Welcome', 'description': 'Search Microchips', 'user': users.get_current_user(), 'is_current_user_admin': users.is_current_user_admin() } # Render the template template = jinja_environment.get_template('admin/events.html') self.response.out.write(template.render(locales))
def get(self): # Get the events event_objs = dal.get_events(active=False) output_event = [] for event_obj in event_objs: output_event.append( { 'headline': event_obj.headline, 'area_name': event_obj.area_name, 'description': event_obj.description, 'how_to_help': event_obj.how_to_help, } ) self.response.out.write(json.dumps(output_event))
def get(self): user = users.get_current_user() if not user: self.redirect(users.create_login_url(self.request.uri)) # Get the events event_objs = dal.get_events() # Locales locales = { 'title': 'Welcome', 'description': 'Search Microchips', 'event_objs': event_objs, 'user': users.get_current_user() } # Render the template template = jinja_environment.get_template('admin/events/list.html') self.response.out.write(template.render(locales))
def get(self): user = users.get_current_user() if not user: self.redirect(users.create_login_url(self.request.uri)) # Get the events event_objs = dal.get_events() # Locales locales = { "title": "Welcome", "description": "Search Microchips", "event_objs": event_objs, "user": users.get_current_user(), } # Render the template template = jinja_environment.get_template("admin/events/list.html") self.response.out.write(template.render(locales))
assert dal.get_most_recent('ph').ph == 7.5 assert dal.get_most_recent('tc').tc == 0 assert getattr(dal.get_most_recent('tc'), 'tc') == 0 dal.add_event_by_time(1, { 'event_type': 'ADD-CL', 'comment': 'added it quickly', 'quantity': 1.0, }) dal.add_event_by_time(1, { 'event_type': 'ADD-ACID', 'comment': 'just for fun', 'quantity': 2.0, }) assert len(dal.get_events(1, 3)) == 2 assert len(dal.get_events_at(1)) == 2 assert len(dal.get_events_by_kind(1, 3, 'ADD-CL')) == 1 event_id = dal.get_events_at(1)[0].event_id assert dal.delete_event_by_id(event_id) == True assert dal.delete_event_by_id(event_id) == False assert len(dal.get_events_at(1)) == 1 assert dal.delete_reading_at(1) == True assert len(dal.get_events_at(1)) == 0 assert len(dal.get_readings(1, 3)) == 2 dal.update_setting('reading_interval', 30) assert dal.get_setting_value('reading_interval') == 30 dal.update_setting('reading_interval', 60) assert dal.get_setting_value('reading_interval') == 60