From de2635fb4ea103a539d8dc080d9dee4ae0feb6d4 Mon Sep 17 00:00:00 2001 From: Davit Gachechiladze <50764979+gachdavit@users.noreply.github.com> Date: Thu, 18 Jul 2019 17:57:25 +0400 Subject: [PATCH] [2.2.x] Fixed #30648 -- Removed unnecessary overriding get_context_data() from mixins with CBVs docs. Backport of 7f612eda80db1c1c8e502aced54c2062080eae46 from master --- docs/topics/class-based-views/mixins.txt | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/docs/topics/class-based-views/mixins.txt b/docs/topics/class-based-views/mixins.txt index ac0648df98b..ad9fb7547bf 100644 --- a/docs/topics/class-based-views/mixins.txt +++ b/docs/topics/class-based-views/mixins.txt @@ -461,11 +461,6 @@ Our new ``AuthorDetail`` looks like this:: def get_success_url(self): return reverse('author-detail', kwargs={'pk': self.object.pk}) - def get_context_data(self, **kwargs): - context = super().get_context_data(**kwargs) - context['form'] = self.get_form() - return context - def post(self, request, *args, **kwargs): if not request.user.is_authenticated: return HttpResponseForbidden() @@ -483,9 +478,7 @@ Our new ``AuthorDetail`` looks like this:: ``get_success_url()`` is just providing somewhere to redirect to, which gets used in the default implementation of -``form_valid()``. We have to provide our own ``post()`` as -noted earlier, and override ``get_context_data()`` to make the -:class:`~django.forms.Form` available in the context data. +``form_valid()``. We have to provide our own ``post()`` as noted earlier. A better solution -----------------