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
context={"disabled": | |
{"top_ranked_hospitals":True} | |
} |
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
{% load books_boxes %} | |
{% if not disabled.top_ranked_books %} | |
{% top_books %} | |
{% endif %} |
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
from django import template | |
register=template.Library() | |
from books.models import Book | |
@register.inclusion_tag('boxes/top_books.html',takes_context=True) | |
def top_books(context): | |
books=Book.objects.all() | |
return {'books':hospitals,"display":books} |
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
from cp_control.control import disable | |
def index(request): | |
disable("someapp.context_processors.top_ranked") #disable one context proccessor, the rest N-1 will be shown | |
context_instance=RequestContext(request) | |
return render_to_response('base.html',context,context_instance) |
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
__author__ = 'tigra' | |
from django.conf import settings | |
def disable(module): | |
module=module, #converting into tuple | |
cp=set(settings.TEMPLATE_CONTEXT_PROCESSORS)-set(module) | |
settings.TEMPLATE_CONTEXT_PROCESSORS=tuple(cp); |