From 8663bc110305844b2f8b0829ee2ddfc5be61b758 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Fri, 6 Apr 2012 21:24:33 +0000 Subject: Fixed #16074 -- Added ContextMixin to class-based generic views to handle get_context_data. Thanks emyller, Luke Plant, Preston Holmes for working on the ticket and patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@17875 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/topics/class-based-views.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'docs') diff --git a/docs/topics/class-based-views.txt b/docs/topics/class-based-views.txt index 8059ed1df2..e1e2618478 100644 --- a/docs/topics/class-based-views.txt +++ b/docs/topics/class-based-views.txt @@ -270,6 +270,16 @@ more:: context['book_list'] = Book.objects.all() return context +.. note:: + + Generally, get_context_data will merge the context data of all parent classes + with those of the current class. To preserve this behavior in your own classes + where you want to alter the context, you should be sure to call + get_context_data on the super class. When no two classes try to define the same + key, this will give the expected results. However if any class attempts to + override a key after parent classes have set it (after the call to super), any + children of that class will also need to explictly set it after super if they + want to be sure to override all parents. Viewing subsets of objects -------------------------- -- cgit v1.3