def _generate_upload_filename(filename): filename = filename.lower() name, extension = os.path.splitext(filename) while Image.where('name', '=', filename).count() == 1: uid = shortuuid.uuid()[0:7] filename = "{}-{}.{}".format(name, uid, extension) return filename
def images(self): Image.where('bucket_name', '=', self.bucket_name)