Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
MOOC packages by hacklab
django-courses-legacy
Commits
b8f2e84f
Commit
b8f2e84f
authored
Apr 04, 2019
by
Bruno Martin
Browse files
oader for templates from the django apps themes
parent
5c7938f2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
28 deletions
+3
-28
courses_legacy/core/loaders.py
courses_legacy/core/loaders.py
+3
-28
No files found.
courses_legacy/core/loaders.py
View file @
b8f2e84f
"""
Wrapper for loading templates from the TIM Tec themes.
"""
from
django.conf
import
settings
from
django.template.loaders.filesystem
import
Loader
from
django.apps
import
apps
...
...
@@ -9,29 +5,9 @@ from django.utils._os import safe_join
class
TimtecThemeLoader
(
Loader
):
# is_usable = True
# def get_template_sources(self, template_name):
# """
# The template name shold be in format: theme_name:templatename.html
# The THEMES_DIR variable must be set in settings.py
# Usage example: {% extends "default:course.html" %}
# """
# if ':' in template_name:
# theme_name, template_name = template_name.split(":", 1)
# template_dirs = [safe_join(settings.THEMES_DIR, theme_name, 'templates')]
# # try to load template from theme app
# elif apps.is_installed(settings.TIMTEC_THEME):
# theme_app_config = apps.get_app_config(settings.TIMTEC_THEME)
# template_dirs = [safe_join(theme_app_config.path, 'templates')]
# else:
# # LEGACY: try to load theme from themes dir
# template_dirs = [safe_join(settings.THEMES_DIR, settings.TIMTEC_THEME, 'templates')]
# template_dirs.append(safe_join(settings.THEMES_DIR, 'default', 'templates'))
# return super(TimtecThemeLoader, self).get_template_sources(template_name, template_dirs)
"""
Loader for templates from the django apps themes.
"""
def
get_dirs
(
self
):
...
...
@@ -39,4 +15,3 @@ class TimtecThemeLoader(Loader):
theme_app_config
=
apps
.
get_app_config
(
settings
.
TIMTEC_THEME
)
template_dirs
=
[
safe_join
(
theme_app_config
.
path
,
'templates'
)]
return
template_dirs
# return self.dirs if self.dirs is not None else self.engine.dirs
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment