def display_image_page(routing_id): ''' get image with this routing id ''' f = Storedfile.query.filter_by(routing_id=routing_id).first() ''' return image page, pass the file class object to the page ''' time = time_ago_in_words(f.upload_time) return render_template("image-page.html", f=f, time=time)
def display_gallery(gallery_routing): g = Gallery.query.filter_by(gallery_routing=gallery_routing).first() images = g.storedfiles.order_by(Storedfile.upload_time).all() db.session.commit() time=time_ago_in_words(g.upload_time) return render_template("gallery.html", g=g, images=images, time=time)
def display_vertical_gallery(gallery_routing): ''' get the gallery with this routing_id ''' g = Gallery.query.filter_by(gallery_routing=gallery_routing).first() ''' gets images that are in this gallery ''' images = g.storedfiles.order_by(Storedfile.upload_time).all() ''' makes a list of links for these images by calling display_image, passes list to the gallery page ''' db.session.commit() time = time_ago_in_words(g.upload_time) return render_template("gallery-page-vertical.html", g=g, images=images, time=time)
def get_days_ago(self, obj): return time_ago_in_words(obj.created)