mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-01 09:02:26 +00:00
Change default storage for uploaded files
This commit is contained in:
parent
69c7140911
commit
d3d64c62fb
2 changed files with 31 additions and 1 deletions
23
printer/migrations/0008_auto_20181012_1242.py
Normal file
23
printer/migrations/0008_auto_20181012_1242.py
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.10.7 on 2018-10-12 10:42
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import django.core.files.storage
|
||||||
|
from django.db import migrations, models
|
||||||
|
import printer.utils
|
||||||
|
import printer.validators
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('printer', '0007_auto_20180925_1351'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='jobwithoptions',
|
||||||
|
name='file',
|
||||||
|
field=models.FileField(storage=django.core.files.storage.FileSystemStorage(location='/var/impressions'), upload_to=printer.utils.user_printing_path, validators=[printer.validators.FileValidator(allowed_types=['application/pdf'], max_size=26214400)]),
|
||||||
|
),
|
||||||
|
]
|
|
@ -7,6 +7,8 @@ Author : Maxime Bombar <bombar@crans.org>.
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.core.files.storage import FileSystemStorage
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.forms import ValidationError
|
from django.forms import ValidationError
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
@ -78,7 +80,12 @@ class JobWithOptions(RevMixin, models.Model):
|
||||||
('Finished', 'Finished')
|
('Finished', 'Finished')
|
||||||
)
|
)
|
||||||
user = models.ForeignKey('users.User', on_delete=models.PROTECT)
|
user = models.ForeignKey('users.User', on_delete=models.PROTECT)
|
||||||
file = models.FileField(upload_to=user_printing_path, validators=[FileValidator(allowed_types=ALLOWED_TYPES, max_size=MAX_PRINTFILE_SIZE)])
|
file = models.FileField(storage=FileSystemStorage(location='/var/impressions'),
|
||||||
|
upload_to=user_printing_path,
|
||||||
|
validators=[FileValidator(
|
||||||
|
allowed_types=ALLOWED_TYPES,
|
||||||
|
max_size=MAX_PRINTFILE_SIZE)
|
||||||
|
])
|
||||||
filename = models.CharField(max_length=255,null=True)
|
filename = models.CharField(max_length=255,null=True)
|
||||||
starttime = models.DateTimeField(auto_now_add=True)
|
starttime = models.DateTimeField(auto_now_add=True)
|
||||||
endtime = models.DateTimeField(null=True)
|
endtime = models.DateTimeField(null=True)
|
||||||
|
|
Loading…
Reference in a new issue