def get(self, article): template = None; dictionary = {} someKey = db.Key.from_path("Person", article); someEntity = db.get(someKey) # decide which template should be applied, and pass that template to get_template if (someEntity != None): someKey = db.Key.from_path("Person", article) template = jinja_environment.get_template('templates/article_person.html') self.populateDictForPerson(dictionary, someEntity) else: someKey = db.Key.from_path("Organization", article); someEntity = db.get(someKey) if (someEntity != None): someKey = db.Key.from_path("Organization", article) template = jinja_environment.get_template('templates/article_organization.html') self.populateDictForOrganization(dictionary, someEntity) else: someKey = db.Key.from_path("Crisis", article); someEntity = db.get(someKey) if (someEntity != None): someKey = db.Key.from_path("Crisis", article) template = jinja_environment.get_template('templates/article_crisis.html') self.populateDictForCrisis(dictionary, someEntity) self.response.write(template.render(dictionary))
def get(self, pagetype): dictionary = { 'article_list': [], 'page_title': pagetype, } modelsQuery = self.getProperModelList(pagetype) for someModel in modelsQuery: self.populateDict(dictionary['article_list'], someModel) template = jinja_environment.get_template('templates/article_list.html') print(dictionary) self.response.write(template.render(dictionary))
def get(self): template = jinja_environment.get_template('templates/about_us.html') self.response.write(template.render({}))
def get(self): template = jinja_environment.get_template('templates/main.html') self.response.write(template.render({'upload_url' : "/upload" }))