def post(self): url_id = int(self.request.get('gallery_id')) gallery_details = Gallery.get_by_id(url_id) upload = self.get_uploads()[0] blobinfo = blobstore.BlobInfo(upload.key()) filename = blobinfo.filename upload_image = Image() upload_image.image_name = filename upload_image.blobs = upload.key() upload_image.put() gallery_details.image_key.append(upload_image.key) gallery_details.put() self.redirect('/gallery?url=' + str(gallery_details.key.urlsafe()))