Korektury: odstraň diakritiku ze jména souboru

This commit is contained in:
Matěj Kocián 2016-08-29 15:05:23 +02:00
parent 089ff4ff31
commit a8a4364f60
2 changed files with 6 additions and 1 deletions

View file

@ -10,10 +10,14 @@ from django.core.exceptions import ObjectDoesNotExist
import subprocess import subprocess
from reversion import revisions as reversion from reversion import revisions as reversion
from unidecode import unidecode
# PrilohaReseni method # PrilohaReseni method
def generate_filename(self, filename): def generate_filename(self, filename):
clean = filename.replace('/','-').replace('\0', '').replace(":","_") clean = unidecode(
filename.replace('/', '-').replace('\0', '').replace(":", "_")
)
fname = "%s_%s" % ( fname = "%s_%s" % (
timezone.now().strftime('%Y-%m-%d-%H_%M'), timezone.now().strftime('%Y-%m-%d-%H_%M'),
clean) clean)

View file

@ -8,6 +8,7 @@ pytz==2015.7
six==1.10.0 six==1.10.0
pexpect==4.0.1 pexpect==4.0.1
traitlets==4.0.0 traitlets==4.0.0
Unidecode==0.4.19
# Django and modules # Django and modules