Fixed #17749 - Documented better way of overriding ModelAdmin; thanks chrisdpratt and claudep.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17582 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Timo Graham 2012-02-24 22:50:36 +00:00
parent 1525874238
commit e4f468b940
1 changed files with 3 additions and 4 deletions

View File

@ -1278,11 +1278,10 @@ provided some extra mapping data that would not otherwise be available::
pass pass
def change_view(self, request, object_id, extra_context=None): def change_view(self, request, object_id, extra_context=None):
my_context = { extra_context = extra_context or {}
'osm_data': self.get_osm_info(), extra_context['osm_data'] = self.get_osm_info()
}
return super(MyModelAdmin, self).change_view(request, object_id, return super(MyModelAdmin, self).change_view(request, object_id,
extra_context=my_context) extra_context=extra_context)
.. versionadded:: 1.4 .. versionadded:: 1.4