If you need to know if you want to display part of the HTML, and you are going to use this rule in other templates, you can try using django.template.RequestContext and make it available to the status variable in the templates that need.
def context(request): return {'render_a_panel' : request.user.username in ('Jim', 'Tom')}
Of course, this only works if your rule is based on a query.
source share