forked from mirrors/bookwyrm
Correctly serialize edition ids in work page
This commit is contained in:
parent
9238f4c74a
commit
19a9136ebb
1 changed files with 7 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.db.models import Q
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from model_utils.managers import InheritanceManager
|
from model_utils.managers import InheritanceManager
|
||||||
|
|
||||||
|
@ -149,7 +150,12 @@ class Work(OrderedCollectionPageMixin, Book):
|
||||||
@property
|
@property
|
||||||
def editions_path(self):
|
def editions_path(self):
|
||||||
''' it'd be nice to serialize the edition instead but, recursion '''
|
''' it'd be nice to serialize the edition instead but, recursion '''
|
||||||
return [e.remote_id for e in self.edition_set.all()]
|
default = self.default_edition
|
||||||
|
ed_list = [
|
||||||
|
e.local_id for e in self.edition_set.filter(~Q(id=default.id)).all()
|
||||||
|
]
|
||||||
|
return [default.local_id] + ed_list
|
||||||
|
|
||||||
|
|
||||||
def to_edition_list(self, **kwargs):
|
def to_edition_list(self, **kwargs):
|
||||||
''' activitypub serialization for this work's editions '''
|
''' activitypub serialization for this work's editions '''
|
||||||
|
|
Loading…
Reference in a new issue