mirror of
https://github.com/django/django.git
synced 2025-07-05 02:09:13 +00:00
boulder-oracle-sprint: Merged to [5258]
git-svn-id: http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint@5259 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
41921a4e73
commit
786782edc5
@ -1765,8 +1765,8 @@ exist. For example::
|
||||
|
||||
When you provide a model to this shortcut function, the default manager
|
||||
is used to execute the underlying ``get()`` query. If you don't want to
|
||||
use the default manager, or you want to search a list of related objects,
|
||||
you can provide ``get_object_or_404()`` with a manager object, instead.
|
||||
use the default manager, or if you want to search a list of related objects,
|
||||
you can provide ``get_object_or_404()`` with a manager object instead.
|
||||
For example::
|
||||
|
||||
# Get the author of blog instance `e` with a name of 'Fred'
|
||||
@ -1779,8 +1779,8 @@ For example::
|
||||
get_list_or_404()
|
||||
-----------------
|
||||
|
||||
``get_list_or_404`` behaves the same was as ``get_object_or_404()``
|
||||
-- except the it uses using ``filter()`` instead of ``get()``. It raises
|
||||
``get_list_or_404`` behaves the same way as ``get_object_or_404()``
|
||||
-- except that it uses ``filter()`` instead of ``get()``. It raises
|
||||
``Http404`` if the list is empty.
|
||||
|
||||
Falling back to raw SQL
|
||||
|
@ -1759,6 +1759,15 @@ But this template code is good::
|
||||
|
||||
<a href="{{ object.get_absolute_url }}">{{ object.name }}</a>
|
||||
|
||||
.. note::
|
||||
The string you return from ``get_absolute_url()`` must be use only ASCII
|
||||
characters (required by the URI spec, `RFC 2396`_) that has been
|
||||
URL-encoded, if necessary. Code and templates using ``get_absolute_url()``
|
||||
should be able to use the result directly without needing to do any
|
||||
further processing.
|
||||
|
||||
.. _RFC 2396: http://www.ietf.org/rfc/rfc2396.txt
|
||||
|
||||
The ``permalink`` decorator
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
@ -146,7 +146,10 @@ put into those elements.
|
||||
exist, it tries calling a method ``item_link()`` in the ``Feed`` class,
|
||||
passing it a single parameter, ``item``, which is the object itself.
|
||||
Both ``get_absolute_url()`` and ``item_link()`` should return the item's
|
||||
URL as a normal Python string.
|
||||
URL as a normal Python string. As with ``get_absolute_url()``, the
|
||||
result of ``item_link()`` will be included directly in the URL, so you
|
||||
are responsible for doing all necessary URL quoting and conversion to
|
||||
ASCII inside the method itself.
|
||||
|
||||
* For the LatestEntries example above, we could have very simple feed templates:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user