From 088d056c1bc17668f88a94a681cd8cf65a32a21a Mon Sep 17 00:00:00 2001 From: Maxime Bombar Date: Mon, 2 Jul 2018 12:56:49 +0200 Subject: [PATCH] Printer app really is optionnal --- re2o/context_processors.py | 10 ++++++++++ templates/base.html | 2 ++ 2 files changed, 12 insertions(+) diff --git a/re2o/context_processors.py b/re2o/context_processors.py index a2e205c2..c72cbb5d 100644 --- a/re2o/context_processors.py +++ b/re2o/context_processors.py @@ -27,6 +27,7 @@ from django.contrib import messages from preferences.models import GeneralOption, OptionalMachine +from re2o.settings import INSTALLED_APPS def context_user(request): """Fonction de context lorsqu'un user est logué (ou non), @@ -47,3 +48,12 @@ def context_user(request): 'name_website': GeneralOption.get_cached_value('site_name'), 'ipv6_enabled': OptionalMachine.get_cached_value('ipv6'), } + +def context_printer(request): + """ + Useful to know whether the printer app is activated or not + """ + printer = 'printer' in INSTALLED_APPS + return { + 'printer': printer, + } diff --git a/templates/base.html b/templates/base.html index 85457292..c6782da8 100644 --- a/templates/base.html +++ b/templates/base.html @@ -112,12 +112,14 @@ with this program; if not, write to the Free Software Foundation, Inc., {% acl_end %} + {% if printer %} + {% endif %} {% can_view_app logs %}
  • {% trans "Statistics" %}
  • {% acl_end %}