Django

Code

Ticket #8704 (closed: fixed)

Opened 2 years ago

Last modified 9 months ago

Improve context processor documentation

Reported by: shacker Assigned to: kkubasik
Milestone: Component: Documentation
Version: SVN Keywords: kkmegapatch
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 1

Description

The answer to the common question "How do I make variables globally available to my templates?" is "context processors," which are covered at http://www.djangoproject.com/documentation/templates_python/ . But a new developer looking for an answer to this question will never find it in the docs by searching for "global" or "global variables." The documentation is there, but very difficult to find by searching on terms related to the problem. No new developer will know to search for "context processors."

Once the right section of the documentation is found, under the cryptic title "Subclassing Context: RequestContext?," implementing the code samples on that page will only yield exception errors like "global name 'RequestContext?' is not defined." Which means absolutely nothing (in terms of the fix) to the new Django developer. The code samples on that page should state that you need to:

from django.template import RequestContext?

To promote Django acceptance, make learning the system less painful. Be specific, come up with a tagging system for the documentation to lead new developers to the right spot in the docs, and provide complete implementation details everywhere.

Attachments

request_context_global.diff (0.9 kB) - added by programmerq on 03/10/09 18:10:58.
Added entry to the FAQ

Change History

02/25/09 15:13:05 changed by jacob

  • needs_better_patch changed.
  • needs_docs changed.
  • stage changed from Unreviewed to Accepted.
  • needs_tests changed.
  • milestone set to 1.1.

Probably the best approach would be an entry in the FAQ -- context processors aren't just about global variables. But changing the section title might be a good idea, too.

03/10/09 18:10:58 changed by programmerq

  • attachment request_context_global.diff added.

Added entry to the FAQ

03/10/09 18:11:29 changed by programmerq

  • has_patch set to 1.
  • stage changed from Accepted to Ready for checkin.

I'm no writer, but here's a FAQ entry.

03/30/09 10:02:23 changed by kkubasik

  • keywords set to kkmegapatch.
  • owner changed from nobody to kkubasik.

03/30/09 12:59:38 changed by gwilson

  • needs_better_patch set to 1.
  • stage changed from Ready for checkin to Accepted.
  • summary changed from Global variables documentation (context processors) to Improve context processor documentation.
  • milestone deleted.

Instead of a FAQ entry, I think we should instead improve the context processor documentation to better explain how and why to use them. The current section:

http://docs.djangoproject.com/en/dev/ref/templates/api/#writing-your-own-context-processors

...doesn't really say much.

I would even say that this new/revised context processor documentation should go in its own file, as the template api documentation is already very long.

03/31/09 18:34:04 changed by jacob

  • status changed from new to closed.
  • resolution set to fixed.

(In [10303]) A whole lotta documentation fixes: Fixes #8704, #8826, #8980, #9243, #9343, #9529,

06/18/09 02:57:38 changed by anonymous

Interesting, I was having this exact problem and the google search came up with this article, which solved the problem. The search was for: global name 'RequestContext?' is not defined


Add/Change #8704 (Improve context processor documentation)




Change Properties
Action