In Django templates, `Context` is a stack. What for?

Django docs say that Context object is a stack:

from django.template import Context
c = Context()
c['a'] = 1
c.push() # Make a new Context level
c['a'] = 2
print(repr(c)) # [{'a': 1}, {'a': 2}]

Also the docs say

Using a Context as a stack comes in handy in some custom template tags

However, there's no example for that. My suggestion: it's useful to render a subtemplate with a clean context ; but one can just use a new empty Context() object instead.

So, what's the use case?


The use case would be scoping, for example in loops and template inheritance.

Need Your Help

How to do JavaMail in EE6 right?

java jpa-2.0 java-ee-6 javamail quartz-scheduler

I was wondering how other's do their mailing stuff and what is you opinion about best practices. When I think about how the mailing stuff can be done, I can only think of one solution that can be

iOS - Manipulate HTML NSString To Grab Only Paragraphs In HTML Output

html ios objective-c html5 nsstring

When I parse an article with Readability's Parse API, it spits the article content back to me as an NSString looking like this: