mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-16 16:33:12 +00:00
[Printer] Add new Job status
This commit is contained in:
parent
5c4c56244c
commit
71831c1483
3 changed files with 27 additions and 6 deletions
20
printer/migrations/0007_auto_20180925_1351.py
Normal file
20
printer/migrations/0007_auto_20180925_1351.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.10.7 on 2018-09-25 11:51
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('printer', '0006_auto_20180908_1258'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='jobwithoptions',
|
||||||
|
name='status',
|
||||||
|
field=models.CharField(choices=[('Pending', 'Pending'), ('Printable', 'Printable'), ('Running', 'Running'), ('Cancelled', 'Cancelled'), ('Finished', 'Finished')], max_length=255),
|
||||||
|
),
|
||||||
|
]
|
|
@ -71,10 +71,11 @@ class JobWithOptions(RevMixin, models.Model):
|
||||||
```_update_price``` update printing price
|
```_update_price``` update printing price
|
||||||
"""
|
"""
|
||||||
STATUS_AVAILABLE = (
|
STATUS_AVAILABLE = (
|
||||||
('Printable', 'Printable'),
|
('Pending', 'Pending'),
|
||||||
('Running', 'Running'),
|
('Printable', 'Printable'),
|
||||||
('Cancelled', 'Cancelled'),
|
('Running', 'Running'),
|
||||||
('Finished', 'Finished')
|
('Cancelled', 'Cancelled'),
|
||||||
|
('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(upload_to=user_printing_path, validators=[FileValidator(allowed_types=ALLOWED_TYPES, max_size=MAX_PRINTFILE_SIZE)])
|
||||||
|
|
|
@ -64,7 +64,7 @@ def new_job(request):
|
||||||
# raise ValidationError("'%(path)s'", code='path', params = {'path': job.printAs})
|
# raise ValidationError("'%(path)s'", code='path', params = {'path': job.printAs})
|
||||||
if job.printAs is None:
|
if job.printAs is None:
|
||||||
job.printAs = request.user
|
job.printAs = request.user
|
||||||
job.status='Printable'
|
job.status='Pending'
|
||||||
# raise
|
# raise
|
||||||
# raise ValidationError("'%(path)s'", code='path', params = {'path': request.FILES['form-%s-file' % i].temporary_file_path()})
|
# raise ValidationError("'%(path)s'", code='path', params = {'path': request.FILES['form-%s-file' % i].temporary_file_path()})
|
||||||
# job_data = model_to_dict(job)
|
# job_data = model_to_dict(job)
|
||||||
|
@ -111,7 +111,7 @@ def new_job(request):
|
||||||
old_job = JobWithOptions.objects.get(id=jids[i])
|
old_job = JobWithOptions.objects.get(id=jids[i])
|
||||||
job = job_obj.save(commit=False)
|
job = job_obj.save(commit=False)
|
||||||
job.user = request.user
|
job.user = request.user
|
||||||
job.status = 'Running'
|
job.status = 'Printable'
|
||||||
job.file = old_job.file
|
job.file = old_job.file
|
||||||
job._update_price()
|
job._update_price()
|
||||||
job.save()
|
job.save()
|
||||||
|
|
Loading…
Reference in a new issue