# 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'))))
+ role = models.CharField(max_length=128, blank=True, db_index=True, choices=[
+ ('', '–'),
+ ('recommend', _('recommended')),
+ ])
slugs = [slug.rstrip('/').rsplit('/', 1)[-1] if '/' in slug else slug for slug in slugs]
return models.Q(slug__in=slugs)
def get_books(self):
from catalogue.models import Book
slugs = [slug.rstrip('/').rsplit('/', 1)[-1] if '/' in slug else slug for slug in slugs]
return models.Q(slug__in=slugs)
def get_books(self):
from catalogue.models import Book