X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/945eac1969985192b4f628ec68ac3468643cb9cd..166e471ceb2a6a051abf3458d19b92d75496bfaf:/src/catalogue/models.py
diff --git a/src/catalogue/models.py b/src/catalogue/models.py
index 04bbf851..be7c37f7 100644
--- a/src/catalogue/models.py
+++ b/src/catalogue/models.py
@@ -384,11 +384,8 @@ class Book(WikidataModel):
for work_type in WorkType.objects.all()
}
- def scans_gallery(self):
- bs = self.booksource_set.first()
- if bs is None:
- return ''
- return bs.pk
+ def scans_galleries(self):
+ return [bs.pk for bs in self.booksource_set.all()]
def is_published(self):
return any(b.is_published() for b in self.document_books.all())
@@ -429,6 +426,15 @@ class Book(WikidataModel):
self._content_stats = stats
return stats
+ @property
+ def are_sources_ready(self):
+ if not self.booksource_set.exists():
+ return False
+ for bs in self.booksource_set.all():
+ if not bs.source.has_view_files() or not bs.source.has_ocr_files() or bs.source.modified_at > bs.source.processed_at:
+ return False
+ return True
+
chars = lambda self: self.content_stats.get('chars', '')
chars_with_fn = lambda self: self.content_stats.get('chars_with_fn', '')
words = lambda self: self.content_stats.get('words', '')
@@ -597,7 +603,12 @@ class BookMonthlyStats(models.Model):
class Thema(models.Model):
- code = models.CharField(max_length=128, unique=True)
+ code = models.CharField(
+ max_length=128, unique=True,
+ help_text='Używamy rozszerzenia .WL-
do oznaczania wÅasnych kodów.
'
+ 'PrzykÅadowo, w przypadku potrzeby stworzenia nowej kategorii âinsurekcja koÅciuszkowskaâ, '
+ 'można by jÄ
utworzyÄ jako 3MLQâPLâA.WL-A, czyli w ramach już istniejÄ
cej wyższej kategorii 3MLQâPLâA ârozbiory Polskiâ.',
+ )
name = models.CharField(max_length=1024)
slug = models.SlugField(
max_length=255, null=True, blank=True, unique=True,