2018-06-28 18:20:08 +00:00
|
|
|
# -*- mode: python; coding: utf-8 -*-
|
|
|
|
|
|
|
|
"""printer.forms
|
|
|
|
Form to add, edit, cancel printer jobs.
|
|
|
|
Author : Maxime Bombar <bombar@crans.org>.
|
|
|
|
Date : 29/06/2018
|
|
|
|
"""
|
|
|
|
|
|
|
|
from django import forms
|
|
|
|
from django.forms import (
|
|
|
|
Form,
|
|
|
|
ModelForm,
|
|
|
|
)
|
|
|
|
|
|
|
|
import itertools
|
|
|
|
|
|
|
|
from re2o.mixins import FormRevMixin
|
|
|
|
|
|
|
|
from .models import (
|
|
|
|
JobWithOptions,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2018-06-29 03:05:15 +00:00
|
|
|
class JobWithOptionsForm(FormRevMixin, ModelForm):
|
2018-06-28 18:20:08 +00:00
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
2018-06-29 03:05:15 +00:00
|
|
|
super(JobWithOptionsForm, self).__init__(*args, prefix=prefix, **kwargs)
|
2018-06-28 18:20:08 +00:00
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = JobWithOptions
|
|
|
|
fields = [
|
|
|
|
'file',
|
|
|
|
'color',
|
|
|
|
'disposition',
|
|
|
|
'count',
|
|
|
|
]
|
|
|
|
|