Добавил поле "обложка" для модели Artist
This commit is contained in:
@@ -10,8 +10,14 @@ def album_cover_upload_to(instance, filename):
|
||||
return os.path.join("album_covers", f"{uuid.uuid4()}.{ext}")
|
||||
|
||||
|
||||
def artist_cover_upload_to(instance, filename):
|
||||
ext = filename.split(".")[-1]
|
||||
return os.path.join("artist_covers", f"{uuid.uuid4()}.{ext}")
|
||||
|
||||
|
||||
class Artist(BaseModel):
|
||||
name = models.CharField(max_length=200)
|
||||
cover_image = models.ImageField(upload_to=artist_cover_upload_to, null=True, blank=True)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.name}"
|
||||
|
||||
Reference in New Issue
Block a user