mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-23 07:23:46 +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,10 +71,11 @@ class JobWithOptions(RevMixin, models.Model):
|
|||
```_update_price``` update printing price
|
||||
"""
|
||||
STATUS_AVAILABLE = (
|
||||
('Printable', 'Printable'),
|
||||
('Running', 'Running'),
|
||||
('Cancelled', 'Cancelled'),
|
||||
('Finished', 'Finished')
|
||||
('Pending', 'Pending'),
|
||||
('Printable', 'Printable'),
|
||||
('Running', 'Running'),
|
||||
('Cancelled', 'Cancelled'),
|
||||
('Finished', 'Finished')
|
||||
)
|
||||
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)])
|
||||
|
|
|
@ -64,7 +64,7 @@ def new_job(request):
|
|||
# raise ValidationError("'%(path)s'", code='path', params = {'path': job.printAs})
|
||||
if job.printAs is None:
|
||||
job.printAs = request.user
|
||||
job.status='Printable'
|
||||
job.status='Pending'
|
||||
# raise
|
||||
# raise ValidationError("'%(path)s'", code='path', params = {'path': request.FILES['form-%s-file' % i].temporary_file_path()})
|
||||
# job_data = model_to_dict(job)
|
||||
|
@ -111,7 +111,7 @@ def new_job(request):
|
|||
old_job = JobWithOptions.objects.get(id=jids[i])
|
||||
job = job_obj.save(commit=False)
|
||||
job.user = request.user
|
||||
job.status = 'Running'
|
||||
job.status = 'Printable'
|
||||
job.file = old_job.file
|
||||
job._update_price()
|
||||
job.save()
|
||||
|
|
Loading…
Reference in a new issue