1👍
class Photo(models.Model):
.....
photo = models.ImageField(upload_to=upload_photo_path_function)
.....
def upload_photo_path_function(instance, filename):
path = os.path.join('files/', instance.album.title)
return path
Source:stackexchange.com