From a8a4364f601affc60892fac6ee13faf17d98ac1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Mon, 29 Aug 2016 15:05:23 +0200 Subject: [PATCH] =?UTF-8?q?Korektury:=20odstra=C5=88=20diakritiku=20ze=20j?= =?UTF-8?q?m=C3=A9na=20souboru?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/models.py | 6 +++++- requirements.txt | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/korektury/models.py b/korektury/models.py index 2ede1f7e..ff0ba62f 100644 --- a/korektury/models.py +++ b/korektury/models.py @@ -10,10 +10,14 @@ from django.core.exceptions import ObjectDoesNotExist import subprocess from reversion import revisions as reversion +from unidecode import unidecode + # PrilohaReseni method def generate_filename(self, filename): - clean = filename.replace('/','-').replace('\0', '').replace(":","_") + clean = unidecode( + filename.replace('/', '-').replace('\0', '').replace(":", "_") + ) fname = "%s_%s" % ( timezone.now().strftime('%Y-%m-%d-%H_%M'), clean) diff --git a/requirements.txt b/requirements.txt index 77d913ea..c2d0b32b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,6 +8,7 @@ pytz==2015.7 six==1.10.0 pexpect==4.0.1 traitlets==4.0.0 +Unidecode==0.4.19 # Django and modules