def returnPPPhotosUrls(projectKey): listofphotokeys = [projectKey + "/" + photo.photoKey for photo in sorted( PhotoProject.objects.get(projectKey=projectKey).photos, key=lambda photo: photo.placeNumber)] s3keys = [bucket.get_key(photokey) for photokey in listofphotokeys] listofphotourls = [s3key.generate_url(3600, query_auth=False, force_http=True) for s3key in s3keys] return listofphotourls
def index(): # PhotoProject.objects(projectKey = "probaprojekat")[0].delete() #put projectkey in config indexproject = PhotoProject.objects.get(projectKey="indexphotos") key1= indexproject.photos[0].photoKey for photo in indexproject.photos: if photo.photoKey == 1: key1 = photo.photoKey key = bucket.get_key("indexphotos" + "/" + key1) imgurl = key.generate_url(3600, query_auth=False, force_http=True) return render_template("index.html", title='Home', imgurl=imgurl, projectList=sortPhotosProjects(returnPublishedProjects()))