# django
Django>=1.8,<1.9
-fnpdjango>=0.1.15,<0.2
+fnpdjango>=0.2.8,<0.3
django-pipeline>=1.6,<1.7
jsmin
fnp-django-pagination
class BuildHtml(BuildEbook):
def build(self, fieldfile):
from django.core.files.base import ContentFile
- from fnpdjango.utils.text.slughifi import slughifi
+ from slugify import slugify
from sortify import sortify
from librarian import html
from catalogue.models import Fragment, Tag
if lang == settings.LANGUAGE_CODE:
# Allow creating themes if book in default language.
tag, created = Tag.objects.get_or_create(
- slug=slughifi(theme_name),
+ slug=slugify(theme_name),
category='theme')
if created:
tag.name = theme_name
from django.db import models
from django.utils.translation import ugettext_lazy as _
import jsonfield
-from fnpdjango.utils.text.slughifi import slughifi
+from slugify import slugify
from mutagen import MutagenError
from catalogue.fields import OverwriteStorage
def _file_upload_to(i, _n):
- return 'book/%(ext)s/%(name)s.%(ext)s' % {'ext': i.ext(), 'name': slughifi(i.name)}
+ return 'book/%(ext)s/%(name)s.%(ext)s' % {'ext': i.ext(), 'name': slugify(i.name)}
class BookMedia(models.Model):
old = None
else:
# if name changed, change the file name, too
- if slughifi(self.name) != slughifi(old.name):
+ if slugify(self.name) != slugify(old.name):
self.file.save(None, ExistingFile(self.file.path), save=False)
super(BookMedia, self).save(*args, **kwargs)
@staticmethod
def tags_from_info(info):
- from fnpdjango.utils.text.slughifi import slughifi
+ from slugify import slugify
from sortify import sortify
meta_tags = []
categories = (('kinds', 'kind'), ('genres', 'genre'), ('authors', 'author'), ('epochs', 'epoch'))
tag_name = tag_name.readable()
if lang == settings.LANGUAGE_CODE:
# Allow creating new tag, if it's in default language.
- tag, created = Tag.objects.get_or_create(slug=slughifi(tag_name), category=category)
+ tag, created = Tag.objects.get_or_create(slug=slugify(tag_name), category=category)
if created:
tag_name = unicode(tag_name)
tag.name = tag_name
from traceback import extract_stack
from django.test import TestCase
from django.test.utils import override_settings
-from fnpdjango.utils.text.slughifi import slughifi
+from slugify import slugify
from librarian import WLURI
from django.conf import settings
def info_args(title, language=None):
""" generate some keywords for comfortable BookInfoCreation """
- slug = unicode(slughifi(title))
+ slug = unicode(slugify(title))
if language is None:
language = u'pol'
return {
#
import re
import string
-from fnpdjango.utils.text.slughifi import char_map
+from fnpdjango.utils.text import char_map
# PayU chokes on non-Polish diacritics.
# Punctuation is handled correctly and escaped as needed,
from django import forms
from django.utils.translation import ugettext_lazy as _
-from fnpdjango.utils.text.slughifi import slughifi
+from slugify import slugify
from isbn.management.commands.import_onix import UNKNOWN
from isbn.models import ONIXRecord, ISBNPool
return {'role': 'A01', 'name': output_name}
def slug(self):
- return slughifi('fnp %s %s' % (self.cleaned_data['authors'], self.cleaned_data['title']))
+ return slugify('fnp %s %s' % (self.cleaned_data['authors'], self.cleaned_data['title']))
def save(self):
data = {
from django.contrib.contenttypes.fields import GenericRelation
from django.core.files.storage import FileSystemStorage
from django.utils.datastructures import SortedDict
-from fnpdjango.utils.text.slughifi import slughifi
+from slugify import slugify
from ssify import flush_ssi_includes
from catalogue.models.tag import prefetched_relations
# str.capitalize() is wrong, because it also lowers letters
objname = objname[0].upper() + objname[1:]
tag, created = catalogue.models.Tag.objects.get_or_create(
- slug=slughifi(objname), category='thing')
+ slug=slugify(objname), category='thing')
if created:
tag.name = objname
setattr(tag, 'name_%s' % lang, tag.name)
for motifs in part['themes']:
for motif in motifs.split(','):
tag, created = catalogue.models.Tag.objects.get_or_create(
- slug=slughifi(motif), category='theme')
+ slug=slugify(motif), category='theme')
if created:
tag.name = motif
tag.sort_key = sortify(tag.name)
# -*- coding: utf-8 -*-
import re
-from fnpdjango.utils.text.slughifi import char_map
+from fnpdjango.utils.text import char_map
# Specifies diacritics order.