class Book(models.Model):
"""Represents a book imported from WL-XML."""
title = models.CharField('tytuł', max_length=32767)
- sort_key = models.CharField('klucz sortowania', max_length=120, db_index=True, editable=False)
+ sort_key = models.CharField('klucz sortowania', max_length=120, db_index=True, db_collation='C', editable=False)
sort_key_author = models.CharField(
- 'klucz sortowania wg autora', max_length=120, db_index=True, editable=False, default='')
+ 'klucz sortowania wg autora', max_length=120, db_index=True, db_collation='C', editable=False, default='')
slug = models.SlugField('slug', max_length=120, db_index=True, unique=True)
common_slug = models.SlugField('wspólny slug', max_length=120, db_index=True)
language = models.CharField('kod języka', max_length=3, db_index=True, default=app_settings.DEFAULT_LANGUAGE)
preview_until = models.DateField('prapremiera do', blank=True, null=True)
preview_key = models.CharField(max_length=32, blank=True, null=True)
findable = models.BooleanField('wyszukiwalna', default=True, db_index=True)
+ can_sell = models.BooleanField('do sprzedaży', default=True)
# files generated during publication
xml_file = fields.XmlField(storage=bofh_storage, with_etag=False)
@classmethod
def from_text_and_meta(cls, raw_file, book_info, overwrite=False, dont_build=None, search_index=True,
- remote_gallery_url=None, days=0, findable=True, logo=None, logo_mono=None, logo_alt=None):
+ remote_gallery_url=None, days=0, findable=True, logo=None, logo_mono=None, logo_alt=None, can_sell=None):
from catalogue import tasks
if dont_build is None:
extra['logo_mono'] = logo_mono
if logo_alt:
extra['logo_alt'] = logo_alt
+ if can_sell is not None:
+ book.can_sell = can_sell
book.extra_info = json.dumps(extra)
book.load_abstract()
book.load_toc()