From 743d7bf608512215503339a4d048568dbb7e4da6 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Mon, 22 Jun 2020 12:23:49 +0200 Subject: [PATCH] cleanup vue debug settings --- cookbook/templates/include/vue_base.html | 13 +++++++++++++ cookbook/templates/meal_plan.html | 7 +------ cookbook/templates/url_import.html | 10 ++++++++++ cookbook/templatetags/custom_tags.py | 6 ++++++ cookbook/views/views.py | 2 +- 5 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 cookbook/templates/include/vue_base.html create mode 100644 cookbook/templates/url_import.html diff --git a/cookbook/templates/include/vue_base.html b/cookbook/templates/include/vue_base.html new file mode 100644 index 000000000..f2a07ee04 --- /dev/null +++ b/cookbook/templates/include/vue_base.html @@ -0,0 +1,13 @@ +{% load static %} +{% load custom_tags %} + +{% is_debug as DEBUG %} +{% if DEBUG %} + +{% else %} + +{% endif %} + + + + \ No newline at end of file diff --git a/cookbook/templates/meal_plan.html b/cookbook/templates/meal_plan.html index 3c46fdbbe..f57243fc8 100644 --- a/cookbook/templates/meal_plan.html +++ b/cookbook/templates/meal_plan.html @@ -6,13 +6,8 @@ {% block extra_head %} - {% if DEBUG %} - - {% else %} - - {% endif %} + {% include 'include/vue_base.html' %} - diff --git a/cookbook/templates/url_import.html b/cookbook/templates/url_import.html new file mode 100644 index 000000000..f7e588482 --- /dev/null +++ b/cookbook/templates/url_import.html @@ -0,0 +1,10 @@ + + + + + $Title$ + + +$END$ + + \ No newline at end of file diff --git a/cookbook/templatetags/custom_tags.py b/cookbook/templatetags/custom_tags.py index ad19a38bb..5533b1d56 100644 --- a/cookbook/templatetags/custom_tags.py +++ b/cookbook/templatetags/custom_tags.py @@ -8,6 +8,7 @@ from django.urls import reverse, NoReverseMatch from cookbook.helper.mdx_attributes import MarkdownFormatExtension from cookbook.helper.mdx_urlize import UrlizeExtension from cookbook.models import get_model_name, CookLog +from recipes import settings register = template.Library() @@ -66,3 +67,8 @@ def recipe_last(recipe, user): return last.created_at else: return '' + + +@register.simple_tag +def is_debug(): + return settings.DEBUG diff --git a/cookbook/views/views.py b/cookbook/views/views.py index bc3e33d15..5c9a34d3a 100644 --- a/cookbook/views/views.py +++ b/cookbook/views/views.py @@ -148,7 +148,7 @@ def get_days_from_week(start, end): @group_required('user') def meal_plan(request): - return render(request, 'meal_plan.html', {'DEBUG': settings.DEBUG}) + return render(request, 'meal_plan.html', {}) @group_required('user')