bornhack-website/src/sponsors/migrations/0010_populate_logo_filename.py

20 lines
509 B
Python
Raw Normal View History

# Generated by Django 2.1.2 on 2018-11-18 13:42
from django.db import migrations
def populate_logo_filename(apps, schema_editor):
Sponsor = apps.get_model('sponsors', 'Sponsor')
for sponsor in Sponsor.objects.all():
sponsor.logo_filename = sponsor.logo.split("/")[-1]
sponsor.save()
class Migration(migrations.Migration):
dependencies = [
('sponsors', '0009_sponsor_logo_filename'),
]
operations = [
migrations.RunPython(populate_logo_filename),
]