X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/d69fc5f16ed739c02685e7d695abf6de59c2bf5e..bf3f18ce9313f4929ff327fbf12803157de171cb:/apps/catalogue/models/book.py diff --git a/apps/catalogue/models/book.py b/apps/catalogue/models/book.py index 3c32481f9..5f68e09ff 100644 --- a/apps/catalogue/models/book.py +++ b/apps/catalogue/models/book.py @@ -30,7 +30,7 @@ def _cover_upload_to(i, n): return 'book/cover/%s.jpg' % i.slug def _cover_thumb_upload_to(i, n): - return 'book/cover_thumb/%s.jpg' % i.slug, + return 'book/cover_thumb/%s.jpg' % i.slug def _ebook_upload_to(upload_path): def _upload_to(i, n): @@ -40,7 +40,7 @@ def _ebook_upload_to(upload_path): class Book(models.Model): """Represents a book imported from WL-XML.""" - title = models.CharField(_('title'), max_length=120) + title = models.CharField(_('title'), max_length=32767) sort_key = models.CharField(_('sort key'), max_length=120, db_index=True, editable=False) sort_key_author = models.CharField(_('sort key by author'), max_length=120, db_index=True, editable=False, default=u'') slug = models.SlugField(_('slug'), max_length=120, db_index=True, @@ -71,7 +71,7 @@ class Book(models.Model): parent = models.ForeignKey('self', blank=True, null=True, related_name='children') - ancestor = models.ManyToManyField('self', blank=True, null=True, + ancestor = models.ManyToManyField('self', blank=True, editable=False, related_name='descendant', symmetrical=False) objects = models.Manager() @@ -99,7 +99,7 @@ class Book(models.Model): def save(self, force_insert=False, force_update=False, **kwargs): from sortify import sortify - self.sort_key = sortify(self.title) + self.sort_key = sortify(self.title)[:120] self.title = unicode(self.title) # ??? try: