More filters in catalogue.
[redakcja.git] / src / catalogue / models.py
index 7a203dd..151a13e 100644 (file)
@@ -138,6 +138,7 @@ class NotableBook(OrderableModel):
 class Category(WikidataModel):
     name = models.CharField(_("name"), max_length=255)
     slug = models.SlugField(max_length=255, unique=True)
+    description = models.TextField(_("description"), blank=True, help_text=_('for publication'))
 
     class Meta:
         abstract = True
@@ -287,6 +288,12 @@ class Book(WikidataModel):
     def translators_last_names(self):
         return ', '.join(a.last_name for a in self.translators.all())
 
+    def document_book__project(self):
+        b = self.document_books.first()
+        if b is None: return ''
+        if b.project is None: return ''
+        return b.project.name
+
     def get_estimated_costs(self):
         return {
             work_type: work_type.calculate(self)