While adding a custom view to ModelAdmin, I encountered a strange problem, which I suspect is a bug.
If my custom view is derived from generic.TemplateView, all the custom site_header that I specified in my AdminSite specialized class is reflected. But if I derive a custom view from generic.FormView, it doesn't. Digging into the Django source I notice that the get() method of ProcessFormView is defined as thus: def get(self, request, *args, **kwargs): return self.render_to_response(self.get_context_data()) whereas the same method in TemplateView is defined as: def get(self, request, *args, **kwargs): context = self.get_context_data(**kwargs) return self.render_to_response(context) The difference being the missing **kwargs passed to get_context_data(). If I override the get() method in my view class and pass the kwargs to get_context_data(), it works as expected. Since custom views in in admin sites pass additional context data via a view wrapper function (result of AdminSite.each_context() along with other stuff), the required template variables such as site_header are not available for views derived from FormView. Has anyone else encountered this? I searched the issue database, but couldn't find anything. I'm posting it here as per the Django bug submission guidelines, which suggests that it's best to check it here before raising an official issue ticket. Thanks Hari -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ec739d69-2d15-4dee-893c-58325f618640n%40googlegroups.com.