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 20236 ModelFormMixin get_context_data() duplicates some/all of parent SingleObjectMixin Matthew Somerville Karol Sikora "The {{{get_context_data}}} function on {{{ModelFormMixin}}} sets {{{context[context_object_name]}}} if {{{self.object}}} and {{{context_object_name}}} are present - then its parent {{{SingleObjectMixin}}} does the same (without checking {{{self.object}}}). So {{{ModelFormMixin}}}'s function could be reduced to: {{{ def get_context_data(self, **kwargs): context = {} if self.object: context['object'] = self.object context.update(kwargs) return super(ModelFormMixin, self).get_context_data(**context) }}} If #20234 is applied, the {{{get_context_data}}} of {{{ModelFormMixin}}} becomes entirely superfluous, as then {{{SingleObjectMixin}}} sets {{{context['object']}}} too, and it can just inherit its behaviour." Cleanup/optimization closed Generic views dev Normal fixed marc.tamlyn@… info@… Accepted 0 0 0 0 0 0