forked from mirrors/bookwyrm
ec2a43faa5
I was getting the following error when running 0035: AttributeError: 'Edition' object has no attribute 'get_rank', But that line seems to be unnecessary, since save() does the same thing, and we are already calling that.
26 lines
684 B
Python
26 lines
684 B
Python
# Generated by Django 3.0.7 on 2021-01-11 17:18
|
|
|
|
import bookwyrm.models.fields
|
|
from django.db import migrations
|
|
|
|
|
|
def set_rank(app_registry, schema_editor):
|
|
db_alias = schema_editor.connection.alias
|
|
books = app_registry.get_model('bookwyrm', 'Edition')
|
|
for book in books.objects.using(db_alias):
|
|
book.save()
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('bookwyrm', '0034_importjob_complete'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.AddField(
|
|
model_name='edition',
|
|
name='edition_rank',
|
|
field=bookwyrm.models.fields.IntegerField(default=0),
|
|
),
|
|
migrations.RunPython(set_rank),
|
|
]
|