Small file fix

This commit is contained in:
Skia 2016-08-31 02:05:04 +02:00
parent cb90ab8e57
commit fcfbfb3a0b
3 changed files with 21 additions and 3 deletions

View File

@ -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),
),
]

View File

@ -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"))

View File

@ -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'