X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/0cae17bec6d31806615fae59a5b3945016285fbe..c7c8dfb7ad2240ffc0135dbd9dd871c85f211a29:/apps/catalogue/models.py diff --git a/apps/catalogue/models.py b/apps/catalogue/models.py index 9786150e6..feccaedf4 100644 --- a/apps/catalogue/models.py +++ b/apps/catalogue/models.py @@ -34,8 +34,8 @@ class TagSubcategoryManager(models.Manager): class Tag(TagBase): name = models.CharField(_('name'), max_length=50, unique=True, db_index=True) - slug = models.SlugField(_('slug'), unique=True, db_index=True) - sort_key = models.SlugField(_('sort key'), db_index=True) + slug = models.SlugField(_('slug'), max_length=120, unique=True, db_index=True) + sort_key = models.SlugField(_('sort key'), max_length=120, db_index=True) category = models.CharField(_('category'), max_length=50, blank=False, null=False, db_index=True, choices=TAG_CATEGORIES) description = models.TextField(blank=True) @@ -70,7 +70,7 @@ class Tag(TagBase): class Book(models.Model): title = models.CharField(_('title'), max_length=120) - slug = models.SlugField(_('slug'), unique=True, db_index=True) + slug = models.SlugField(_('slug'), max_length=120, unique=True, db_index=True) description = models.TextField(_('description'), blank=True) created_at = models.DateTimeField(_('creation date'), auto_now=True) _short_html = models.TextField(_('short HTML'), editable=False) @@ -102,8 +102,8 @@ class Book(models.Model): if self.odt_file: formats.append(u'Plik ODT' % self.odt_file.url) - self._short_html = unicode(render_to_string('catalogue/book_short.html', - {'book': self, 'tags': tags, 'formats': formats})) + self._short_html = render_to_string('catalogue/book_short.html', + {'book': self, 'tags': tags, 'formats': formats}) self.save() return mark_safe(self._short_html) @@ -221,8 +221,8 @@ class Fragment(models.Model): book_authors = [u'%s' % (tag.get_absolute_url(), tag.name) for tag in self.book.tags if tag.category == 'author'] - self._short_html = unicode(render_to_string('catalogue/fragment_short.html', - {'fragment': self, 'book': self.book, 'book_authors': book_authors})) + self._short_html = render_to_string('catalogue/fragment_short.html', + {'fragment': self, 'book': self.book, 'book_authors': book_authors}) self.save() return mark_safe(self._short_html)