X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/e977f7187b10b1bc0a30794cd585c6b840568996..e22b691a1c2ac0e1aba750771cd17f032f47c172:/src/documents/models/book.py diff --git a/src/documents/models/book.py b/src/documents/models/book.py index e7c34814..24d0cea0 100644 --- a/src/documents/models/book.py +++ b/src/documents/models/book.py @@ -1,6 +1,7 @@ # This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # +from django.apps import apps from django.contrib.sites.models import Site from django.db import models, transaction from django.template.loader import render_to_string @@ -89,6 +90,11 @@ class Book(models.Model): def gallery_url(self): return '%s%s%s/' % (settings.MEDIA_URL, settings.IMAGE_DIR, self.gallery) + @property + def catalogue_book(self): + CBook = apps.get_model('catalogue', 'Book') + return CBook.objects.filter(slug=self.dc_slug).first() + # Creating & manipulating # =======================