Opened 15 years ago
Closed 15 years ago
#11743 closed (duplicate)
Error in generic views documentation
Reported by: | Fredde | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.1 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
There is an error in http://docs.djangoproject.com/en/dev/topics/generic-views/#adding-extra-context:
"The problem has to do with when the queries in extra_context are evaluated. Because this example puts Publisher.objects.all() in the URLconf, it will be evaluated only once (when the URLconf is first loaded). Once you add or remove publishers, you'll notice that the generic view doesn't reflect those changes until you reload the Web server (see Caching and QuerySets for more information about when QuerySets are cached and evaluated)."
It's the Book.objects.all() that's only evaluated once.
Duplicate of #11554