from django.utils.decorators import method_decorator
from django.views.decorators.vary import vary_on_headers
from django.views.generic import FormView
+from unidecode import unidecode
+
from .forms import UploadForm
else:
def thumbnail(relpath):
try:
- return default.backend.get_thumbnail(relpath, "x50").url
+ thumb = default.backend.get_thumbnail(relpath, "x50")
+ if not thumb.exists():
+ # That's not an image. No thumb.
+ return None
+ return thumb.url
except IOError:
# That's not an image. No thumb.
return None
os.makedirs(path)
data = []
for f in flist:
+ f.name = unidecode(f.name)
with open(self.get_safe_path(f.name), 'w') as destination:
for chunk in f.chunks():
destination.write(chunk)