Skip to content

Commit

Permalink
Merge pull request #38 from ccnmtl/context-processor
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolas authored Oct 10, 2024
2 parents d38253c + d4f0949 commit a89bc74
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
0.3.7
====================
* Added a custom context processor to make settings available in
templates.

0.3.6 (2024-10-09)
====================
* Added ENVIRONMENT django setting, denoting either 'staging' or
Expand Down
11 changes: 11 additions & 0 deletions ctlsettings/context_processors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django.conf import settings


def env(request):
"""
Environment variables from settings for use in templates.
"""
return {
'STAGING_ENV': getattr(settings, 'STAGING_ENV', False),
'ENVIRONMENT': getattr(settings, 'ENVIRONMENT', 'development'),
}
1 change: 1 addition & 0 deletions ctlsettings/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def common(**kwargs):
'django.template.context_processors.request',
'django.contrib.messages.context_processors.messages',
'stagingcontext.staging_processor',
'ctlsettings.context_processors.env',
'gacontext.ga_processor',
],
},
Expand Down

0 comments on commit a89bc74

Please sign in to comment.