Merge pull request #520 from cincodenada/fix-migration-0035

Fix error in migrations
This commit is contained in:
Mouse Reeve 2021-01-13 19:18:24 -08:00 committed by GitHub
commit cda53cc919
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 3 deletions

View file

@ -8,7 +8,6 @@ def set_rank(app_registry, schema_editor):
db_alias = schema_editor.connection.alias db_alias = schema_editor.connection.alias
books = app_registry.get_model('bookwyrm', 'Edition') books = app_registry.get_model('bookwyrm', 'Edition')
for book in books.objects.using(db_alias): for book in books.objects.using(db_alias):
book.edition_rank = book.get_rank
book.save() book.save()
class Migration(migrations.Migration): class Migration(migrations.Migration):

View file

@ -178,7 +178,6 @@ class Edition(Book):
activity_serializer = activitypub.Edition activity_serializer = activitypub.Edition
name_field = 'title' name_field = 'title'
@property
def get_rank(self): def get_rank(self):
''' calculate how complete the data is on this edition ''' ''' calculate how complete the data is on this edition '''
if self.parent_work and self.parent_work.default_edition == self: if self.parent_work and self.parent_work.default_edition == self:
@ -204,7 +203,7 @@ class Edition(Book):
self.isbn_13 = isbn_10_to_13(self.isbn_10) self.isbn_13 = isbn_10_to_13(self.isbn_10)
# set rank # set rank
self.edition_rank = self.get_rank self.edition_rank = self.get_rank()
return super().save(*args, **kwargs) return super().save(*args, **kwargs)