mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 14:13:21 +00:00
Small file fix
This commit is contained in:
parent
cb90ab8e57
commit
fcfbfb3a0b
19
core/migrations/0002_auto_20160831_0144.py
Normal file
19
core/migrations/0002_auto_20160831_0144.py
Normal 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),
|
||||||
|
),
|
||||||
|
]
|
@ -446,7 +446,7 @@ def get_directory(instance, filename):
|
|||||||
return './{0}/{1}'.format(instance.get_parent_path(), filename)
|
return './{0}/{1}'.format(instance.get_parent_path(), filename)
|
||||||
|
|
||||||
class SithFile(models.Model):
|
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)
|
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)
|
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"))
|
owner = models.ForeignKey(User, related_name="owned_files", verbose_name=_("owner"))
|
||||||
|
@ -58,8 +58,7 @@ class AddFilesForm(forms.Form):
|
|||||||
new_file.clean()
|
new_file.clean()
|
||||||
new_file.save()
|
new_file.save()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.add_error(None, _("Error uploading file %(file_name)s: %(msg)s") %
|
self.add_error(None, _("Error uploading file %(file_name)s: %(msg)s") % {'file_name': f, 'msg': repr(e)})
|
||||||
{'file_name': f, 'msg': str(e.message)})
|
|
||||||
|
|
||||||
class FileListView(ListView):
|
class FileListView(ListView):
|
||||||
template_name = 'core/file_list.jinja'
|
template_name = 'core/file_list.jinja'
|
||||||
|
Loading…
Reference in New Issue
Block a user