Set default edition on bookwyrm import

This commit is contained in:
Mouse Reeve
2021-01-11 10:25:34 -08:00
parent 83852e29eb
commit fe67f65307
3 changed files with 10 additions and 4 deletions

View File

@ -131,12 +131,14 @@ class Work(OrderedCollectionPageMixin, Book):
def get_default_edition(self):
''' in case the default edition is not set '''
return self.default_edition or self.editions.first()
return self.default_edition or self.editions.order_by(
'-edition_rank'
).first()
def to_edition_list(self, **kwargs):
''' an ordered collection of editions '''
return self.to_ordered_collection(
self.editions.order_by('-updated_date').all(),
self.editions.order_by('-edition_rank').all(),
remote_id='%s/editions' % self.remote_id,
**kwargs
)