From 3dfe2e8c75196bd7c9a3cf52ef6c804ac3f86355 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 12 Apr 2011 21:22:03 +0200 Subject: [PATCH] file names and upload file size --- pandora/archive/models.py | 11 ++++++----- pandora/settings.py | 5 +++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/pandora/archive/models.py b/pandora/archive/models.py index 422010f1e..568f29563 100644 --- a/pandora/archive/models.py +++ b/pandora/archive/models.py @@ -303,7 +303,11 @@ class File(models.Model): return None def get_folder(self): + instance = self.get_instance() + if instance: + return instance.folder name = os.path.splitext(self.get_name())[0] + name = name.replace('. ', '||').split('.')[0].replace('||', '. ') if self.item: if settings.USE_IMDB: director = self.item.get('director', ['Unknown Director']) @@ -321,16 +325,13 @@ class File(models.Model): def get_name(self): instance = self.get_instance() if instance: - return self.get_instance().name + return instance.name if self.item: name = self.item.get('title', 'Untitled') name = re.sub(r'[:\\/]', '_', name) if not name: name = 'Untitled' - if self.instances.count() > 0: - ext = os.path.splitext(self.instances.all()[0].name)[-1] - else: - ext = '.unknown' + ext = '.unknown' return name + ext class Volume(models.Model): diff --git a/pandora/settings.py b/pandora/settings.py index 60d9d0089..e92ca72b0 100644 --- a/pandora/settings.py +++ b/pandora/settings.py @@ -87,6 +87,11 @@ STATIC_URL = '/static/' # Examples: "http://foo.com/media/", "/media/". ADMIN_MEDIA_PREFIX = '/admin/media/' + +#max upload size, +#needs to be in line with setting in nginx/apache +FILE_UPLOAD_MAX_MEMORY_SIZE=32*1024*1024 + # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader',