diff --git a/printer/migrations/0007_auto_20180925_1351.py b/printer/migrations/0007_auto_20180925_1351.py new file mode 100644 index 00000000..08db95fc --- /dev/null +++ b/printer/migrations/0007_auto_20180925_1351.py @@ -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), + ), + ] diff --git a/printer/models.py b/printer/models.py index 782753db..a0c43b7b 100644 --- a/printer/models.py +++ b/printer/models.py @@ -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)]) diff --git a/printer/views.py b/printer/views.py index b964043f..d013b43f 100644 --- a/printer/views.py +++ b/printer/views.py @@ -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()