Add link properties for remotes

This commit is contained in:
Mouse Reeve
2021-12-05 12:28:17 -08:00
parent 099b516321
commit 2d875b5575
5 changed files with 29 additions and 15 deletions

View File

@ -52,6 +52,16 @@ class BookDataModel(ObjectMixin, BookWyrmModel):
null=True,
)
@property
def openlibrary_link(self):
"""generate the url from the openlibrary id"""
return f"https://openlibrary.org/books/{self.openlibrary_key}"
@property
def inventaire_link(self):
"""generate the url from the inventaire id"""
return f"https://inventaire.io/entity/{self.inventaire_id}"
class Meta:
"""can't initialize this model, that wouldn't make sense"""