4

According to the relevant Django documentation, a request context offers more than a normal context in that it merges request data into the context.

It is hence necessary for views that perform form submission in Django.

However, I am wondering why one cannot just always pass a request context for every view. After all, a request context offers more than a normal context.

Why not create a helper function called, say, render() that automatically passes a request context? Is there a performance disadvantage?

  • django.shortcuts.render is an easy way to use RequestContext. – Colin Dunklau Feb 18 '13 at 1:56
6

There is a performance disadvantage. It should be faster to render a template with an small context than with big context (i.e. the request context).

  • 2
    Can you elaborate a little more on your answer? – user8 Jan 20 '12 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.