template.Context.flatten()

Context.flatten() Using flatten() method you can get whole Context stack as one dictionary including builtin variables. >>> c = Context() >>> c['foo'] = 'first level' >>> c.update({'bar': 'second level'}) {'bar': 'second level'} >>> c.flatten() {'True': True, 'None': None, 'foo': 'first level', 'False': False, 'bar': 'second level'} A flatten() method is also internally used to make Context objects comparable. >>> c1 = Context() >>> c1['

template.Context.get()

Context.get(key, otherwise=None) Returns the value for key if key is in the context, else returns otherwise.

template.Context.pop()

Context.pop()

template.Context.push()

Context.push()

template.Context.setdefault()

Context.setdefault(key, default=None) New in Django 1.9. If key is in the context, returns its value. Otherwise inserts key with a value of default and returns default.

template.Context.update()

Context.update(other_dict) [source] In addition to push() and pop(), the Context object also defines an update() method. This works like push() but takes a dictionary as an argument and pushes that dictionary onto the stack instead of an empty one. >>> c = Context() >>> c['foo'] = 'first level' >>> c.update({'foo': 'updated'}) {'foo': 'updated'} >>> c['foo'] 'updated' >>> c.pop() {'foo': 'updated'} >>> c['foo'] 'first level' Like push(),

template.context_processors.debug()

debug() [source] If this processor is enabled, every RequestContext will contain these two variables – but only if your DEBUG setting is set to True and the request’s IP address (request.META['REMOTE_ADDR']) is in the INTERNAL_IPS setting: debug – True. You can use this in templates to test whether you’re in DEBUG mode. sql_queries – A list of {'sql': ..., 'time': ...} dictionaries, representing every SQL query that has happened so far during the request and how long it took. The list is i

template.context_processors.static()

static() [source] If this processor is enabled, every RequestContext will contain a variable STATIC_URL, providing the value of the STATIC_URL setting.

template.context_processors.tz()

tz() [source] If this processor is enabled, every RequestContext will contain a variable TIME_ZONE, providing the name of the currently active time zone.

template.defaultfilters.stringfilter()

django.template.defaultfilters.stringfilter() If you’re writing a template filter that only expects a string as the first argument, you should use the decorator stringfilter. This will convert an object to its string value before being passed to your function: from django import template from django.template.defaultfilters import stringfilter register = template.Library() @register.filter @stringfilter def lower(value): return value.lower() This way, you’ll be able to pass, say, an in