From fcfbfb3a0b923b93804eff942b05e22f63e2da0e Mon Sep 17 00:00:00 2001 From: Skia Date: Wed, 31 Aug 2016 02:05:04 +0200 Subject: [PATCH] Small file fix --- core/migrations/0002_auto_20160831_0144.py | 19 +++++++++++++++++++ core/models.py | 2 +- core/views/files.py | 3 +-- 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 core/migrations/0002_auto_20160831_0144.py diff --git a/core/migrations/0002_auto_20160831_0144.py b/core/migrations/0002_auto_20160831_0144.py new file mode 100644 index 00000000..a2b49e2b --- /dev/null +++ b/core/migrations/0002_auto_20160831_0144.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='sithfile', + name='name', + field=models.CharField(verbose_name='file name', max_length=256), + ), + ] diff --git a/core/models.py b/core/models.py index e5e5dc78..f4ccce91 100644 --- a/core/models.py +++ b/core/models.py @@ -446,7 +446,7 @@ def get_directory(instance, filename): return './{0}/{1}'.format(instance.get_parent_path(), filename) class SithFile(models.Model): - name = models.CharField(_('file name'), max_length=30, blank=False) + name = models.CharField(_('file name'), max_length=256, blank=False) parent = models.ForeignKey('self', related_name="children", verbose_name=_("parent"), null=True, blank=True) file = models.FileField(upload_to=get_directory, verbose_name=_("file"), null=True, blank=True) owner = models.ForeignKey(User, related_name="owned_files", verbose_name=_("owner")) diff --git a/core/views/files.py b/core/views/files.py index 92e0f545..a14ca8e2 100644 --- a/core/views/files.py +++ b/core/views/files.py @@ -58,8 +58,7 @@ class AddFilesForm(forms.Form): new_file.clean() new_file.save() except Exception as e: - self.add_error(None, _("Error uploading file %(file_name)s: %(msg)s") % - {'file_name': f, 'msg': str(e.message)}) + self.add_error(None, _("Error uploading file %(file_name)s: %(msg)s") % {'file_name': f, 'msg': repr(e)}) class FileListView(ListView): template_name = 'core/file_list.jinja'