From 6ac8d81389e834d681879a200e3e2ae67fb4fdfa Mon Sep 17 00:00:00 2001 From: Zambom Date: Thu, 12 Jan 2017 18:23:18 -0200 Subject: [PATCH] Change css templatetag by context_processor --- amadeus/context_processors.py | 10 ++++++++++ amadeus/settings.py | 1 + amadeus/templates/base.html | 8 +++++--- amadeus/templates/css_theme.html | 5 ----- amadeus/templatetags/css_theme.py | 15 --------------- 5 files changed, 16 insertions(+), 23 deletions(-) create mode 100644 amadeus/context_processors.py delete mode 100644 amadeus/templates/css_theme.html delete mode 100644 amadeus/templatetags/css_theme.py diff --git a/amadeus/context_processors.py b/amadeus/context_processors.py new file mode 100644 index 0000000..ec6916a --- /dev/null +++ b/amadeus/context_processors.py @@ -0,0 +1,10 @@ +from themes.models import Themes + +def theme(request): + context = {} + + theme = Themes.objects.get(id = 1) + + context['theme'] = theme + + return context \ No newline at end of file diff --git a/amadeus/settings.py b/amadeus/settings.py index 36e817f..0589c9b 100644 --- a/amadeus/settings.py +++ b/amadeus/settings.py @@ -92,6 +92,7 @@ TEMPLATES = [ 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', + 'amadeus.context_processors.theme', ], }, }, diff --git a/amadeus/templates/base.html b/amadeus/templates/base.html index d402ece..76b85b5 100644 --- a/amadeus/templates/base.html +++ b/amadeus/templates/base.html @@ -1,6 +1,6 @@ -{% load static i18n django_bootstrap_breadcrumbs css_theme %} +{% load static i18n django_bootstrap_breadcrumbs %} {% get_current_language as LANGUAGE_CODE %} @@ -59,7 +59,9 @@ - {% css_theme %} + {% with 'css/themes/'|add:theme.css_style|add:'.css' as theme_selected %} + + {% endwith %} @@ -73,7 +75,7 @@ - Projeto Amadeus + {{ theme.title }}