Activitypub serialize shelves
This commit is contained in:
parent
932b4abcfe
commit
45e5df388d
6 changed files with 58 additions and 4 deletions
|
@ -3,6 +3,7 @@ from django.utils import timezone
|
|||
from django.db import models
|
||||
from model_utils.managers import InheritanceManager
|
||||
|
||||
from fedireads import activitypub
|
||||
from fedireads.settings import DOMAIN
|
||||
from fedireads.utils.fields import JSONField, ArrayField
|
||||
from fedireads.utils.models import FedireadsModel
|
||||
|
@ -110,6 +111,10 @@ class Book(FedireadsModel):
|
|||
self.title,
|
||||
)
|
||||
|
||||
@property
|
||||
def activitypub_serialize(self):
|
||||
return activitypub.get_book(self)
|
||||
|
||||
|
||||
class Work(Book):
|
||||
''' a work (an abstract concept of a book that manifests in an edition) '''
|
||||
|
@ -165,3 +170,7 @@ class Author(FedireadsModel):
|
|||
models.CharField(max_length=255), blank=True, default=list
|
||||
)
|
||||
bio = models.TextField(null=True, blank=True)
|
||||
|
||||
@property
|
||||
def activitypub_serialize(self):
|
||||
return activitypub.get_author(self)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
''' puttin' books on shelves '''
|
||||
from django.db import models
|
||||
|
||||
from fedireads import activitypub
|
||||
from fedireads.utils.models import FedireadsModel
|
||||
|
||||
|
||||
|
@ -23,6 +24,10 @@ class Shelf(FedireadsModel):
|
|||
model_name = type(self).__name__.lower()
|
||||
return '%s/%s/%s' % (base_path, model_name, self.identifier)
|
||||
|
||||
@property
|
||||
def activitypub_serialize(self):
|
||||
return activitypub.get_shelf(self)
|
||||
|
||||
class Meta:
|
||||
unique_together = ('user', 'identifier')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue