Skip to content

Instantly share code, notes, and snippets.

@venkatesh22
Created March 18, 2013 09:56
Show Gist options
  • Save venkatesh22/5186095 to your computer and use it in GitHub Desktop.
Save venkatesh22/5186095 to your computer and use it in GitHub Desktop.
Override render to response and change templates folder dynamically
from django.shortcuts import render_to_response as super_render_to_response
def render_to_response(*args, **kwargs):
"""
Here overriding existing render_to_response method and
changing template if other configuration is enabled
"""
config = True
if config:
args = 'config/' + args[0],
return super_render_to_response(*args, **kwargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment