8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-09-17 11:43:08 +00:00

Fix chargement du réglage printer

This commit is contained in:
Gabriel Detraz 2018-11-29 22:54:51 +01:00 committed by root
parent c6adb87e4b
commit 2c849c7064
3 changed files with 5 additions and 4 deletions

View file

@ -27,6 +27,8 @@ from .validators import (
FileValidator,
)
from preferences.models import OptionalPrinter
from .settings import (
MAX_PRINTFILE_SIZE,
ALLOWED_TYPES,
@ -65,7 +67,8 @@ class Digicode(RevMixin, models.Model, AclMixin, FieldPermissionModelMixin):
@classmethod
def active_codes(cls):
return cls.objects.filter(created__gte = timezone.now() - datetime.timedelta(days=3))
code_duration = OptionalPrinter.get_cached_value('code_duration')
return cls.objects.filter(created__gte = timezone.now() - code_duration)
def _gen_code(user):
try_again = True

View file

@ -16,8 +16,7 @@ def printer_enabled():
"""
Check whether the printer is enabled or not
"""
settings, created = OptionalPrinter.objects.get_or_create()
return settings.Printer_enabled
return OptionalPrinter.get_cached_value('Printer_enabled')
def pdfinfo(file_path):

View file

@ -19,7 +19,6 @@ from re2o.base import (
re2o_paginator,
SortTable
)
from . import settings
from .utils import pdfinfo, send_mail_printer, printer_enabled