def post(self): title = self.request.get("title") type = self.request.get("type") simpledocument = SimpleDocument() if title != "": a = "" if type != "": key = {"events": "Event", "venues": "Venue"}.get(type) if key == None: key = "Event" if key == "": key = "Event" # self.response.out.write('Key %s' %key) # return results = simpledocument.query_document(ndb.Key("Category", key)) template_values = {"results": results} self.render("index", template_values)
def get(self): # @TODO: delete all data in "Root" simpledocument = SimpleDocument() simpledocument.purge() catsKey = ndb.Key("Category", "Event", "Category", "Theatre", "Category", "Musical", "Title", "Cats") catsEvent = SimpleDocument(parent=catsKey, content='{"Description": "Pämiere", "Date": "2015-12-01 20:00" }') catsEvent.put() catsEventKey = catsEvent.key musicalTheatreKey = ndb.Key("Category", "Venue", "Category", "Theatre", "Category", "Musical") globeTheatre = SimpleDocument( parent=musicalTheatreKey, children=[catsEventKey], title="Globe", content='{"Description": "Wooden house whith wooden banks" }', ) globeTheatreKey = globeTheatre.key return self.redirect("/ndb")
def get(self): simpledocument = SimpleDocument() results = simpledocument.query_document(ndb.Key("Category", "Event")) template_values = {"title": "", "content": "", "results": results} self.render("index", template_values)