X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/2ad3a0ff948fcd754043b251e4767808babb25d2..166e471ceb2a6a051abf3458d19b92d75496bfaf:/src/catalogue/models.py
diff --git a/src/catalogue/models.py b/src/catalogue/models.py
index e2d737a2..be7c37f7 100644
--- a/src/catalogue/models.py
+++ b/src/catalogue/models.py
@@ -230,6 +230,10 @@ class Epoch(Category):
class Genre(Category):
+ thema = models.CharField(
+ max_length=32, blank=True,
+ help_text='OdpowiadajÄ
cy kwalifikator Thema.'
+ )
plural = models.CharField(
'liczba mnoga', max_length=255, blank=True,
)
@@ -380,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())
@@ -425,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', '')
@@ -593,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,