Пример #1
0
 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)
Пример #2
0
 def get(self):
     events = EventModel.all().fetch(_MAX_FETCH)
     data = {
         "events": 		events,
         "template":	 	"admin/event_view_all.tpl"
     }
     self.generate(template_base, data)
Пример #3
0
 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)
Пример #4
0
 def delete(self, id):
     event = EventModel.get(id)
     if event:
         event.delete()
         referrer = self.request.headers['referer']
         self.redirect(referrer)
     else:
         self.error(503)
Пример #5
0
 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)