Serialize links for books
This commit is contained in:
@ -23,11 +23,15 @@ class Link(ActivitypubMixin, BookWyrmModel):
|
||||
del kwargs["broadcast"]
|
||||
return super().save(*args, **kwargs)
|
||||
|
||||
def to_activity(self, omit=(), **kwargs):
|
||||
"""we don't need ALL the fields"""
|
||||
return super().to_activity(omit=("@context", "id"), **kwargs)
|
||||
|
||||
|
||||
class FileLink(Link):
|
||||
"""a link to a file"""
|
||||
|
||||
book = fields.ForeignKey(
|
||||
book = models.ForeignKey(
|
||||
"Book", on_delete=models.CASCADE, related_name="file_links", null=True
|
||||
)
|
||||
filetype = fields.CharField(max_length=5, activitypub_field="mediaType")
|
||||
|
Reference in New Issue
Block a user