mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-23 23:43:47 +00:00
[Printer] Add new Job status
This commit is contained in:
parent
ee9827deda
commit
5ca0b644ea
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,6 +71,7 @@ class JobWithOptions(RevMixin, models.Model):
|
||||||
```_update_price``` update printing price
|
```_update_price``` update printing price
|
||||||
"""
|
"""
|
||||||
STATUS_AVAILABLE = (
|
STATUS_AVAILABLE = (
|
||||||
|
('Pending', 'Pending'),
|
||||||
('Printable', 'Printable'),
|
('Printable', 'Printable'),
|
||||||
('Running', 'Running'),
|
('Running', 'Running'),
|
||||||
('Cancelled', 'Cancelled'),
|
('Cancelled', 'Cancelled'),
|
||||||
|
|
|
@ -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