librarian2_api = False
ZIP = None
- def __init__(self, verbose_name_=None, with_etag=True, etag_field_name=None, **kwargs):
- # This is just for compatibility with older migrations,
- # where first argument was for ebook format.
- # Can be scrapped if old migrations are updated/removed.
- verbose_name = verbose_name_ or _("%s file") % self.ext
- kwargs.setdefault('verbose_name', verbose_name_ )
-
- # Another compatibility fix:
- # old migrations use EbookField directly, creating etag fields.
- if type(self) is EbookField:
- with_etag = False
-
+ def __init__(self, verbose_name=None, with_etag=True, etag_field_name=None, **kwargs):
+ kwargs.setdefault('verbose_name', verbose_name)
self.with_etag = with_etag
self.etag_field_name = etag_field_name
kwargs.setdefault('max_length', 255)
else:
kwargs['with_etag'] = self.with_etag
- # Compatibility
- verbose_name = kwargs.get('verbose_name')
- if verbose_name:
- del kwargs['verbose_name']
- if verbose_name != _("%s file") % self.ext:
- args = [verbose_name] + args
return name, path, args, kwargs
-
@classmethod
def get_upload_to(cls, directory):
directory = getattr(cls, 'directory', cls.ext)
('extra_info', models.TextField(default='{}', verbose_name='Additional information')),
('gazeta_link', models.CharField(max_length=240, blank=True)),
('wiki_link', models.CharField(max_length=240, blank=True)),
- ('cover', catalogue.fields.EbookField('cover', storage=fnpdjango.storage.BofhFileSystemStorage(), max_length=255, blank=True, null=True, verbose_name='cover')),
- ('cover_thumb', catalogue.fields.EbookField('cover_thumb', max_length=255, null=True, verbose_name='cover thumbnail', blank=True)),
+ ('cover', models.FileField(storage=fnpdjango.storage.BofhFileSystemStorage(), max_length=255, blank=True, null=True, verbose_name='cover')),
+ ('cover_thumb', models.FileField(max_length=255, null=True, verbose_name='cover thumbnail', blank=True)),
('_related_info', models.TextField(null=True, editable=False, blank=True)),
- ('txt_file', catalogue.fields.EbookField('txt', default='', storage=fnpdjango.storage.BofhFileSystemStorage(), max_length=255, blank=True, verbose_name='TXT file')),
- ('fb2_file', catalogue.fields.EbookField('fb2', default='', storage=fnpdjango.storage.BofhFileSystemStorage(), max_length=255, blank=True, verbose_name='FB2 file')),
- ('pdf_file', catalogue.fields.EbookField('pdf', default='', storage=fnpdjango.storage.BofhFileSystemStorage(), max_length=255, blank=True, verbose_name='PDF file')),
- ('epub_file', catalogue.fields.EbookField('epub', default='', storage=fnpdjango.storage.BofhFileSystemStorage(), max_length=255, blank=True, verbose_name='EPUB file')),
- ('mobi_file', catalogue.fields.EbookField('mobi', default='', storage=fnpdjango.storage.BofhFileSystemStorage(), max_length=255, blank=True, verbose_name='MOBI file')),
- ('html_file', catalogue.fields.EbookField('html', default='', storage=fnpdjango.storage.BofhFileSystemStorage(), max_length=255, blank=True, verbose_name='HTML file')),
- ('xml_file', catalogue.fields.EbookField('xml', default='', storage=fnpdjango.storage.BofhFileSystemStorage(), max_length=255, blank=True, verbose_name='XML file')),
+ ('txt_file', models.FileField(default='', storage=fnpdjango.storage.BofhFileSystemStorage(), max_length=255, blank=True, verbose_name='TXT file')),
+ ('fb2_file', models.FileField(default='', storage=fnpdjango.storage.BofhFileSystemStorage(), max_length=255, blank=True, verbose_name='FB2 file')),
+ ('pdf_file', models.FileField(default='', storage=fnpdjango.storage.BofhFileSystemStorage(), max_length=255, blank=True, verbose_name='PDF file')),
+ ('epub_file', models.FileField(default='', storage=fnpdjango.storage.BofhFileSystemStorage(), max_length=255, blank=True, verbose_name='EPUB file')),
+ ('mobi_file', models.FileField(default='', storage=fnpdjango.storage.BofhFileSystemStorage(), max_length=255, blank=True, verbose_name='MOBI file')),
+ ('html_file', models.FileField(default='', storage=fnpdjango.storage.BofhFileSystemStorage(), max_length=255, blank=True, verbose_name='HTML file')),
+ ('xml_file', models.FileField(default='', storage=fnpdjango.storage.BofhFileSystemStorage(), max_length=255, blank=True, verbose_name='XML file')),
('parent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='children', blank=True, to='catalogue.Book', null=True)),
],
options={