set rank on editions
This commit is contained in:
parent
b44b42be7e
commit
6db64e33e4
2 changed files with 29 additions and 1 deletions
|
@ -4,6 +4,12 @@ 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 = [
|
||||
|
@ -16,4 +22,5 @@ class Migration(migrations.Migration):
|
|||
name='edition_rank',
|
||||
field=bookwyrm.models.fields.IntegerField(default=0),
|
||||
),
|
||||
migrations.RunPython(set_rank),
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue