def create(self): event = EventModel( name=self.request.get("name"), location=self.request.get("location"), date=self.request.get("date"), priority=int(self.request.get("priority")) ) event.put() referrer = self.request.headers['referer'] self.redirect(referrer)
def get(self): events = EventModel.all().fetch(_MAX_FETCH) data = { "events": events, "template": "admin/event_view_all.tpl" } self.generate(template_base, data)
def get(self): events = EventModel.gql("ORDER BY priority DESC").fetch(_MAX_FETCH); data = { "events": events, "template": "public/events.tpl" } self.generate(base_template, data)
def delete(self, id): event = EventModel.get(id) if event: event.delete() referrer = self.request.headers['referer'] self.redirect(referrer) else: self.error(503)
def update(self, id): event = EventModel.get(id) if event: event.name = self.request.get("name") event.date = self.request.get("date") event.location = self.request.get("location") event.priority = int(self.request.get("priority")) event.put() referrer = self.request.headers['referer'] self.redirect(referrer) else: self.error(503)