Commit 6ac8d81389e834d681879a200e3e2ae67fb4fdfa
1 parent
b4af4330
Exists in
master
and in
3 other branches
Change css templatetag by context_processor
Showing
5 changed files
with
16 additions
and
23 deletions
Show diff stats
amadeus/settings.py
@@ -92,6 +92,7 @@ TEMPLATES = [ | @@ -92,6 +92,7 @@ TEMPLATES = [ | ||
92 | 'django.template.context_processors.request', | 92 | 'django.template.context_processors.request', |
93 | 'django.contrib.auth.context_processors.auth', | 93 | 'django.contrib.auth.context_processors.auth', |
94 | 'django.contrib.messages.context_processors.messages', | 94 | 'django.contrib.messages.context_processors.messages', |
95 | + 'amadeus.context_processors.theme', | ||
95 | ], | 96 | ], |
96 | }, | 97 | }, |
97 | }, | 98 | }, |
amadeus/templates/base.html
1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
2 | 2 | ||
3 | -{% load static i18n django_bootstrap_breadcrumbs css_theme %} | 3 | +{% load static i18n django_bootstrap_breadcrumbs %} |
4 | {% get_current_language as LANGUAGE_CODE %} | 4 | {% get_current_language as LANGUAGE_CODE %} |
5 | 5 | ||
6 | <html> | 6 | <html> |
@@ -59,7 +59,9 @@ | @@ -59,7 +59,9 @@ | ||
59 | <!-- Summernote --> | 59 | <!-- Summernote --> |
60 | <script src="{% static 'summernote/summernote.js' %}" type="text/javascript"></script> | 60 | <script src="{% static 'summernote/summernote.js' %}" type="text/javascript"></script> |
61 | <link href="{% static 'summernote/summernote.css' %}" type="text/css" rel="stylesheet" /> | 61 | <link href="{% static 'summernote/summernote.css' %}" type="text/css" rel="stylesheet" /> |
62 | - {% css_theme %} | 62 | + {% with 'css/themes/'|add:theme.css_style|add:'.css' as theme_selected %} |
63 | + <link rel="stylesheet" type="text/css" href="{% static theme_selected %}"> | ||
64 | + {% endwith %} | ||
63 | 65 | ||
64 | </head> | 66 | </head> |
65 | <body> | 67 | <body> |
@@ -73,7 +75,7 @@ | @@ -73,7 +75,7 @@ | ||
73 | </button> | 75 | </button> |
74 | <a class="navbar-brand" href="{% url 'subjects:home' %}"> | 76 | <a class="navbar-brand" href="{% url 'subjects:home' %}"> |
75 | <img class="logo pull-left" src="{% static 'img/topo-amadeus-white.png' %}" alt="Logo" /> | 77 | <img class="logo pull-left" src="{% static 'img/topo-amadeus-white.png' %}" alt="Logo" /> |
76 | - <span class="pull-right project_name">Projeto Amadeus</span> | 78 | + <span class="pull-right project_name">{{ theme.title }}</span> |
77 | </a> | 79 | </a> |
78 | </div> | 80 | </div> |
79 | <div class="navbar-collapse collapse navbar-responsive-collapse"> | 81 | <div class="navbar-collapse collapse navbar-responsive-collapse"> |
amadeus/templates/css_theme.html
amadeus/templatetags/css_theme.py
@@ -1,15 +0,0 @@ | @@ -1,15 +0,0 @@ | ||
1 | -from django import template | ||
2 | - | ||
3 | -from themes.models import Themes | ||
4 | - | ||
5 | -register = template.Library() | ||
6 | - | ||
7 | -@register.inclusion_tag('css_theme.html') | ||
8 | -def css_theme(): | ||
9 | - theme = Themes.objects.get(id = 1) | ||
10 | - | ||
11 | - context = { | ||
12 | - 'theme': theme.css_style | ||
13 | - } | ||
14 | - | ||
15 | - return context | ||
16 | \ No newline at end of file | 0 | \ No newline at end of file |