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?

1
  • django.shortcuts.render is an easy way to use RequestContext. Feb 18, 2013 at 1:56

1 Answer 1

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).

1
  • 2
    Can you elaborate a little more on your answer?
    – user8
    Jan 20, 2012 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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