1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Corrected code examples in topics docs.

This commit is contained in:
Rohit
2025-08-11 09:09:16 +02:00
committed by Sarah Boyce
parent 7a80e29fea
commit fa804d0d14
3 changed files with 4 additions and 4 deletions

View File

@@ -303,7 +303,7 @@ preference, use :func:`django.http.HttpRequest.get_preferred_type`::
def form_invalid(self, form):
response = super().form_invalid(form)
accepted_type = request.get_preferred_type(self.accepted_media_types)
accepted_type = self.request.get_preferred_type(self.accepted_media_types)
if accepted_type == "text/html":
return response
elif accepted_type == "application/json":
@@ -314,7 +314,7 @@ preference, use :func:`django.http.HttpRequest.get_preferred_type`::
# it might do some processing (in the case of CreateView, it will
# call form.save() for example).
response = super().form_valid(form)
accepted_type = request.get_preferred_type(self.accepted_media_types)
accepted_type = self.request.get_preferred_type(self.accepted_media_types)
if accepted_type == "text/html":
return response
elif accepted_type == "application/json":