Removed usage of 'object' variable name in docs.

This commit is contained in:
Harry Moreno 2018-07-06 12:44:04 -04:00 committed by Tim Graham
parent 66b6b68923
commit 6e55cf0de6
2 changed files with 10 additions and 12 deletions

View File

@ -418,13 +418,11 @@ object -- so we simply override it and wrap the call::
queryset = Author.objects.all() queryset = Author.objects.all()
def get_object(self): def get_object(self):
# Call the superclass obj = super().get_object()
object = super().get_object()
# Record the last accessed date # Record the last accessed date
object.last_accessed = timezone.now() obj.last_accessed = timezone.now()
object.save() obj.save()
# Return the object return obj
return object
.. note:: .. note::

View File

@ -127,8 +127,8 @@ You can use the :func:`redirect` function in a number of ways.
def my_view(request): def my_view(request):
... ...
object = MyModel.objects.get(...) obj = MyModel.objects.get(...)
return redirect(object) return redirect(obj)
2. By passing the name of a view and optionally some positional or 2. By passing the name of a view and optionally some positional or
keyword arguments; the URL will be reverse resolved using the keyword arguments; the URL will be reverse resolved using the
@ -156,8 +156,8 @@ will be returned::
def my_view(request): def my_view(request):
... ...
object = MyModel.objects.get(...) obj = MyModel.objects.get(...)
return redirect(object, permanent=True) return redirect(obj, permanent=True)
``get_object_or_404()`` ``get_object_or_404()``
======================= =======================
@ -190,7 +190,7 @@ The following example gets the object with the primary key of 1 from
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
def my_view(request): def my_view(request):
my_object = get_object_or_404(MyModel, pk=1) obj = get_object_or_404(MyModel, pk=1)
This example is equivalent to:: This example is equivalent to::
@ -198,7 +198,7 @@ This example is equivalent to::
def my_view(request): def my_view(request):
try: try:
my_object = MyModel.objects.get(pk=1) obj = MyModel.objects.get(pk=1)
except MyModel.DoesNotExist: except MyModel.DoesNotExist:
raise Http404("No MyModel matches the given query.") raise Http404("No MyModel matches the given query.")