-
Notifications
You must be signed in to change notification settings - Fork 66
Theme Middleware
Andy Byers edited this page Sep 11, 2017
·
2 revisions
The Theme Override Middleware is a piece of code that does the following:
- Works out if there is a journal in the request object
- Attempts to fetch the theme setting for a journal and add that theme to the list of
settings.TEMPLATES['DIRS']
- If no setting is found for the journal theme is set to default
- If no journal is found in the request object we set the theme to the
request.press.theme
- Otherwise, set the theme to default as a failsafe
This means that for any given page request, we ensure the correct theme/templates are served so we don't get any mismatches (ie. Press theme showing for a Journal etc.)
This middleware is loaded in the settings.MIDDLEWARE_CLASSES variable and looks like:
'utils.template_override_middleware.ThemeEngineMiddleware',
Wiki has moved to read the docs.