def get(self): self.response.content_type = 'text/json' if self.request.get('after'): latest_meme_key = ndb.Key(urlsafe=self.request.get('after')) latest_meme = latest_meme_key.get() new_meme_query = Meme.query(Meme.created_at > latest_meme.created_at).order(-Meme.created_at) else: new_meme_query = Meme.query().order(-Meme.created_at) user_id = self.request.get('after') if user_id: new_meme_query = new_meme_query.filter(Meme.creator == user_id) new_memes = new_meme_query.fetch() new_memes_list = [] for meme in new_memes: image = meme.image.get() new_memes_list.append({ 'image_file': image.image_file, 'top_text': meme.top_text, 'middle_text': meme.middle_text, 'bottom_text': meme.bottom_text, 'created_at': meme.created_at.isoformat(), 'key': meme.key.urlsafe(), }) self.response.write(json.dumps(new_memes_list))
def get(self): all_memes = Meme.query().fetch() the_variable_dict = {"all_memes": all_memes} all_memes_template = the_jinja_env.get_template( 'templates/all_memes.html') self.response.write(all_memes_template.render(the_variable_dict))
def get(self): memes = Meme.query().order(-Meme.created_at).fetch(10) if memes: latest_meme_key = memes[0].key.urlsafe() else: latest_meme_key = "" for meme in memes: meme.image_filename = meme.image.get().image_file start_template=jinja_current_directory.get_template( "templates/latestmemes.html") self.response.write(start_template.render({'memes': memes, 'latest_meme': latest_meme_key}))
def get(self): memeStore = Meme.query().fetch() references = { "head1" : "Gallery", "memes" : memeStore } # self.response.headers["Content-Type"] = 'text/plain' # self.response.write("Here are some of my pictures: ") gallery_template = jinja_env.get_template('gallery.html') self.response.write(gallery_template.render(references))
def get(self): checkLoggedInAndRegistered(self) user = users.get_current_user() email_address = user.nickname() user_memes = Meme.query().filter(Meme.owner == email_address).fetch() the_variable_dict = {"user_memes": user_memes} user_memes_template = the_jinja_env.get_template( 'templates/user_memes.html') self.response.write(user_memes_template.render(the_variable_dict))
def get(self): view_template = the_jinja_env.get_template('templates/view.html') memes_result = Meme.query().order().fetch() variable_dict = {"memes": memes_result} self.response.write(view_template.render(variable_dict))
def get(self): memes = Meme.query().order(-Meme.last_touch_date_time).fetch(20) self.response.out.write( template.render('templates/meme.html', {'memes': memes}))
def get(self): memes = Meme.query().order(-Meme.last_touch_date_time).fetch(20) self.response.out.write(template.render("templates/meme.html", {"memes": memes}))
def get(self): all_memes = the_jinja_env.get_template('templates/allmemes.html') memes = Meme.query() memes_list = list(Meme.query().fetch()) memes_dict = {"memes": memes_list} self.response.write(all_memes.render(memes_dict))