Добавил preview_image в Album, чтобы снизить размеры cover image
This commit is contained in:
24
music_storage/music/migrations/0009_album_preview_image.py
Normal file
24
music_storage/music/migrations/0009_album_preview_image.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# Generated by Django 6.0 on 2026-01-04 11:37
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
def create_preview_image(apps, schema_editor):
|
||||
Album = apps.get_model('music', 'Album')
|
||||
for album in Album.objects.all():
|
||||
album.save()
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('music', '0008_alter_track_file'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='album',
|
||||
name='preview_image',
|
||||
field=models.ImageField(blank=True, null=True, upload_to=''),
|
||||
),
|
||||
migrations.RunPython(create_preview_image, reverse_code=migrations.RunPython.noop),
|
||||
]
|
||||
Reference in New Issue
Block a user