8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-25 04:43:10 +00:00

[Printer] Move Options Available from models to settings

This commit is contained in:
Maxime Bombar 2018-10-20 15:52:38 +02:00 committed by root
parent 7da8b03e80
commit 6e7c3bfc55
2 changed files with 43 additions and 32 deletions

View file

@ -26,6 +26,11 @@ from .settings import (
MAX_PRINTFILE_SIZE, MAX_PRINTFILE_SIZE,
ALLOWED_TYPES, ALLOWED_TYPES,
PRICES, PRICES,
FORMAT_AVAILABLE,
COLOR_CHOICES,
DISPOSITIONS_AVAILABLE,
STAPLING_OPTIONS,
PERFORATION_OPTIONS,
) )
from .utils import user_printing_path from .utils import user_printing_path
@ -97,35 +102,6 @@ class JobWithOptions(RevMixin, models.Model):
verbose_name=_("price"), verbose_name=_("price"),
default=0.0) default=0.0)
pages = models.IntegerField(default=0) pages = models.IntegerField(default=0)
FORMAT_AVAILABLE = (
('A4', 'A4'),
('A3', 'A3'),
)
COLOR_CHOICES = (
('Greyscale', 'Greyscale'),
('Color', 'Color')
)
DISPOSITIONS_AVAILABLE = (
('TwoSided', 'Two sided'),
('OneSided', 'One sided'),
('Booklet', 'Booklet')
)
STAPLING_OPTIONS = (
('None', 'None'),
('TopLeft', 'One top left'),
('TopRight', 'One top right'),
('LeftSided', 'Two left sided'),
('RightSided', 'Two right sided')
)
PERFORATION_OPTIONS = (
('None', 'None'),
('TwoLeftSidedHoles', 'Two left sided holes'),
('TwoRightSidedHoles', 'Two right sided holes'),
('TwoTopHoles', 'Two top holes'),
('TwoBottomHoles', 'Two bottom holes'),
('FourLeftSidedHoles', 'Four left sided holes'),
('FourRightSidedHoles', 'Four right sided holes')
)
format = models.CharField(max_length=255, choices=FORMAT_AVAILABLE, default='A4') format = models.CharField(max_length=255, choices=FORMAT_AVAILABLE, default='A4')
color = models.CharField(max_length=255, choices=COLOR_CHOICES, default='Greyscale') color = models.CharField(max_length=255, choices=COLOR_CHOICES, default='Greyscale')

View file

@ -10,6 +10,41 @@ MAX_PRINTFILE_SIZE = settings.max_size * 1024 * 1024 # 25 MB
ALLOWED_TYPES = ['application/pdf'] ALLOWED_TYPES = ['application/pdf']
A3_enabled = settings.A3_enabled
booklet_enabled = settings.booklet_enabled
color_enabled = settings.color_enabled
stapling_enabled = settings.stapling_enabled
perforation_enabled = settings.perforation_enabled
FORMAT_AVAILABLE = (
('A4', 'A4'),
('A3', 'A3'),
)
COLOR_CHOICES = (
('Greyscale', 'Greyscale'),
('Color', 'Color')
)
DISPOSITIONS_AVAILABLE = (
('TwoSided', 'Two sided'),
('OneSided', 'One sided'),
('Booklet', 'Booklet')
)
STAPLING_OPTIONS = (
('None', 'None'),
('TopLeft', 'One top left'),
('TopRight', 'One top right'),
('LeftSided', 'Two left sided'),
('RightSided', 'Two right sided')
)
PERFORATION_OPTIONS = (
('None', 'None'),
('TwoLeftSidedHoles', 'Two left sided holes'),
('TwoRightSidedHoles', 'Two right sided holes'),
('TwoTopHoles', 'Two top holes'),
('TwoBottomHoles', 'Two bottom holes'),
('FourLeftSidedHoles', 'Four left sided holes'),
('FourRightSidedHoles', 'Four right sided holes')
)
## Config ## Config