You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
552 B
19 lines
552 B
from django.db import migrations
|
|
|
|
def populate_books(apps, schema_editor):
|
|
BookEdition = apps.get_model('hadis', 'BookEdition')
|
|
for edition in BookEdition.objects.filter(book_reference__isnull=False):
|
|
edition.books.add(edition.book_reference)
|
|
|
|
def reverse_populate(apps, schema_editor):
|
|
pass
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('hadis', '0066_alter_bookreference_options_bookedition_books_and_more'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(populate_books, reverse_populate),
|
|
]
|