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)
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)
-
+ description = models.TextField(_('description'), blank=True)
+ main_page = models.BooleanField(_('main page'), default=False, db_index=True, help_text=_('Show tag on main page'))
+
user = models.ForeignKey(User, blank=True, null=True)
def has_description(self):
user = models.ForeignKey(User, blank=True, null=True)
def has_description(self):
- self._short_html = render_to_string('catalogue/book_short.html',
- {'book': self, 'tags': tags, 'formats': formats})
+ self._short_html = unicode(render_to_string('catalogue/book_short.html',
+ {'book': self, 'tags': tags, 'formats': formats}))
text = models.TextField()
short_text = models.TextField(editable=False)
_short_html = models.TextField(editable=False)
text = models.TextField()
short_text = models.TextField(editable=False)
_short_html = models.TextField(editable=False)
book = models.ForeignKey(Book, related_name='fragments')
objects = models.Manager()
book = models.ForeignKey(Book, related_name='fragments')
objects = models.Manager()
book_authors = [u'<a href="%s">%s</a>' % (tag.get_absolute_url(), tag.name)
for tag in self.book.tags if tag.category == 'author']
book_authors = [u'<a href="%s">%s</a>' % (tag.get_absolute_url(), tag.name)
for tag in self.book.tags if tag.category == 'author']
- self._short_html = render_to_string('catalogue/fragment_short.html',
- {'fragment': self, 'book': self.book, 'book_authors': book_authors})
+ self._short_html = unicode(render_to_string('catalogue/fragment_short.html',
+ {'fragment': self, 'book': self.book, 'book_authors': book_authors}))