# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django.conf import settings
from django.db import models
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django.conf import settings
from django.db import models
title = models.CharField(_('title'), max_length=120, db_index=True)
slug = models.SlugField(_('slug'), max_length=120, primary_key=True)
description = models.TextField(_('description'), null=True, blank=True)
title = models.CharField(_('title'), max_length=120, db_index=True)
slug = models.SlugField(_('slug'), max_length=120, primary_key=True)
description = models.TextField(_('description'), null=True, blank=True)
-
- kind = models.CharField(_('kind'), max_length=10, blank=False, default='book', db_index=True, choices=((('book'), _('book')), (('picture'), ('picture'))))
+ kind = models.CharField(_('kind'), max_length=10, blank=False, default='book', db_index=True,
+ choices=(('book', _('book')), ('picture', _('picture'))))
- def flush_includes(self, languages=True):
- if not languages:
- return
- if languages is True:
- languages = [lc for (lc, _ln) in settings.LANGUAGES]
+ def get_books(self):
+ from catalogue.models import Book
+ return Book.objects.filter(self.get_query())
+
+ @cached_render('catalogue/collection_box.html')
+ def box(self):
+ return {
+ 'collection': self
+ }