diff options
| author | Davit Gachechiladze <50764979+gachdavit@users.noreply.github.com> | 2019-07-18 17:57:25 +0400 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-07-18 19:47:53 +0200 |
| commit | de2635fb4ea103a539d8dc080d9dee4ae0feb6d4 (patch) | |
| tree | f1993fa27a6f4517d115a5b252016d1c0e9580f7 /docs | |
| parent | 0088e592922e2a711815cdb90a2610a1f1704a9a (diff) | |
[2.2.x] Fixed #30648 -- Removed unnecessary overriding get_context_data() from mixins with CBVs docs.
Backport of 7f612eda80db1c1c8e502aced54c2062080eae46 from master
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/class-based-views/mixins.txt | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/docs/topics/class-based-views/mixins.txt b/docs/topics/class-based-views/mixins.txt index ac0648df98..ad9fb7547b 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 ----------------- |
