Set book availability

This commit is contained in:
Mouse Reeve
2022-01-17 09:21:58 -08:00
parent 7b1693a435
commit 39814a21f2
5 changed files with 51 additions and 26 deletions

View File

@ -47,6 +47,13 @@ class Link(ActivitypubMixin, BookWyrmModel):
return super().save(*args, **kwargs)
AvailabilityChoices = [
("free", _("Free")),
("purchase", _("Purchasable")),
("loan", _("Available for loan")),
]
class FileLink(Link):
"""a link to a file"""
@ -54,7 +61,9 @@ class FileLink(Link):
"Book", on_delete=models.CASCADE, related_name="file_links", null=True
)
filetype = fields.CharField(max_length=50, activitypub_field="mediaType")
is_purchase = fields.BooleanField(null=True, blank=True)
availability = fields.CharField(
max_length=100, choices=AvailabilityChoices, default="free"
)
StatusChoices = [