From c431771b9383be09608109196564c4fecefa6d16 Mon Sep 17 00:00:00 2001 From: Maxime Bombar Date: Sat, 20 Oct 2018 15:59:41 +0200 Subject: [PATCH] [Printer][re2o] Allow to disable printer directly from 'Preference' menu --- re2o/context_processors.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/re2o/context_processors.py b/re2o/context_processors.py index feae6b36..2e29800a 100644 --- a/re2o/context_processors.py +++ b/re2o/context_processors.py @@ -27,7 +27,7 @@ import datetime from django.contrib import messages from django.http import HttpRequest -from preferences.models import GeneralOption, OptionalMachine +from preferences.models import GeneralOption, OptionalMachine, OptionalPrinter from django.utils.translation import get_language from re2o.settings import INSTALLED_APPS @@ -70,7 +70,8 @@ def context_printer(request): """ Useful to know whether the printer app is activated or not """ - printer = 'printer' in INSTALLED_APPS + printerSettings = OptionalPrinter.objects.get() + printer = ('printer' in INSTALLED_APPS) and printerSettings.Printer_enabled return { 'printer': printer, }