﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
17749	Admin documentation on views suggests poor way of adding extra_context	Chris Pratt	nobody	"As reference see: https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.change_view

If you pass `my_context` for `extra_context` in this way, it completely drops any existing context passed in from a subclass also overriding this method. This could lead to a confusing scenario in which Django is seemingly ignoring `extra_context`. One better approach would be:


{{{
def change_view(self, request, object_id, extra_context=None):
    extra_context = extra_context or {}
    extra_context['osm_data'] = self.get_osm_info()
    return super(MyModelAdmin, self).change_view(request, object_id,
            extra_context=extra_context)
}}}

It's a relatively small difference, I'll admit, but since the docs are probably most frequently read by those new to Django and possibly even Python itself, I believe the sample code should take into account eventualities such as the `ModelAdmin` being subclassed."	Cleanup/optimization	closed	Documentation	dev	Normal	fixed	admin, documentation, docs		Accepted	1	0	0	0	1	0
