mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-28 08:03:36 +00:00
Rename the context processor
This commit is contained in:
parent
65cdcb1bc3
commit
418f5ff397
@ -15,14 +15,18 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
"""
|
||||
Django context processors to provide common data to templates.
|
||||
"""
|
||||
|
||||
import re
|
||||
import cfg
|
||||
|
||||
|
||||
def plinth_processor(request):
|
||||
"""Add additional context values to RequestContext for use in templates"""
|
||||
slash_indizes = [m.start() for m in re.finditer('/', request.path)]
|
||||
active_menu_urls = [request.path[:index+1] for index in slash_indizes]
|
||||
def common(request):
|
||||
"""Add additional context values to RequestContext for use in templates."""
|
||||
slash_indices = [match.start() for match in re.finditer('/', request.path)]
|
||||
active_menu_urls = [request.path[:index + 1] for index in slash_indices]
|
||||
return {
|
||||
'cfg': cfg,
|
||||
'submenu': cfg.main_menu.active_item(request),
|
||||
|
||||
@ -126,7 +126,7 @@ def configure_django():
|
||||
'django.core.context_processors.static',
|
||||
'django.core.context_processors.tz',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
'context_processors.plinth_processor']
|
||||
'context_processors.common']
|
||||
|
||||
logging_configuration = {
|
||||
'version': 1,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user