Fixed #14745 - add links to topics/http/shortucts.txt. thanks adamv for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14835 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Timo Graham 2010-12-05 16:47:39 +00:00
parent 2dd594dff4
commit 4800b46746
1 changed files with 20 additions and 18 deletions

View File

@ -39,11 +39,11 @@ Optional arguments
``context_instance`` ``context_instance``
The context instance to render the template with. By default, the template The context instance to render the template with. By default, the template
will be rendered with a ``Context`` instance (filled with values from will be rendered with a :class:`~django.template.Context` instance (filled
``dictionary``). If you need to use :ref:`context processors with values from ``dictionary``). If you need to use :ref:`context
<subclassing-context-requestcontext>`, render the template with a processors <subclassing-context-requestcontext>`, render the template with
``RequestContext`` instance instead. Your code might look something like a :class:`~django.template.RequestContext` instance instead. Your code
this:: might look something like this::
return render_to_response('my_template.html', return render_to_response('my_template.html',
my_data_dictionary, my_data_dictionary,
@ -85,8 +85,8 @@ This example is equivalent to::
.. versionadded:: 1.1 .. versionadded:: 1.1
Returns an HttpResponseRedirect to the apropriate URL for the arguments Returns an :class:`~django.http.HttpResponseRedirect` to the appropriate URL
passed. for the arguments passed.
The arguments could be: The arguments could be:
@ -97,7 +97,7 @@ This example is equivalent to::
* A URL, which will be used as-is for the redirect location. * A URL, which will be used as-is for the redirect location.
By default issues a temporary redirect; pass permanent=True to issue a By default issues a temporary redirect; pass ``permanent=True`` to issue a
permanent redirect permanent redirect
Examples Examples
@ -149,15 +149,15 @@ will be returned::
.. function:: get_object_or_404(klass, *args, **kwargs) .. function:: get_object_or_404(klass, *args, **kwargs)
Calls :meth:`~django.db.models.QuerySet.get()` on a given model manager, Calls :meth:`~django.db.models.QuerySet.get()` on a given model manager,
but it raises ``django.http.Http404`` instead of the model's but it raises :class:`~django.http.Http404` instead of the model's
``DoesNotExist`` exception. :class:`~django.core.exceptions.DoesNotExist` exception.
Required arguments Required arguments
------------------ ------------------
``klass`` ``klass``
A ``Model``, ``Manager`` or ``QuerySet`` instance from which to get the A :class:`~django.db.models.Model`, :class:`~django.db.models.Manager` or
object. :class:`~django.db.models.QuerySet` instance from which to get the object.
``**kwargs`` ``**kwargs``
Lookup parameters, which should be in the format accepted by ``get()`` and Lookup parameters, which should be in the format accepted by ``get()`` and
@ -184,8 +184,9 @@ This example is equivalent to::
except MyModel.DoesNotExist: except MyModel.DoesNotExist:
raise Http404 raise Http404
Note: As with ``get()``, an ``MultipleObjectsReturned`` exception will be Note: As with ``get()``, a
raised if more than one object is found. :class:`~django.core.exceptions.MultipleObjectsReturned` exception
will be raised if more than one object is found.
``get_list_or_404`` ``get_list_or_404``
=================== ===================
@ -193,15 +194,16 @@ raised if more than one object is found.
.. function:: get_list_or_404(klass, *args, **kwargs) .. function:: get_list_or_404(klass, *args, **kwargs)
Returns the result of :meth:`~django.db.models.QuerySet.filter()` on a Returns the result of :meth:`~django.db.models.QuerySet.filter()` on a
given model manager, raising ``django.http.Http404`` if the resulting list given model manager, raising :class:`~django.http.Http404` if the resulting
is empty. list is empty.
Required arguments Required arguments
------------------ ------------------
``klass`` ``klass``
A ``Model``, ``Manager`` or ``QuerySet`` instance from which to get the A :class:`~django.db.models.Model`, :class:`~django.db.models.Manager` or
object. :class:`~django.db.models.query.QuerySet` instance from which to get the
list.
``**kwargs`` ``**kwargs``
Lookup parameters, which should be in the format accepted by ``get()`` and Lookup parameters, which should be in the format accepted by ``get()`` and