-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
82f2dd4
commit e6fac5f
Showing
3 changed files
with
5 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,7 @@ | ||
from django.template import engines | ||
from django.contrib.sessions.middleware import SessionMiddleware | ||
|
||
|
||
def render_template(value, **context): | ||
template = engines['django'].from_string(value) | ||
request = context.pop('request', None) | ||
return template.render(context, request) | ||
|
||
|
||
def add_session_to_request(request): | ||
middleware = SessionMiddleware() | ||
middleware.process_request(request) | ||
request.session.save() |