mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Refs #36485 -- Removed unnecessary parentheses in :meth: and :func: roles in docs.
This commit is contained in:
@@ -288,7 +288,7 @@ Making actions available site-wide
|
||||
|
||||
Some actions are best if they're made available to *any* object in the admin
|
||||
site -- the export action defined above would be a good candidate. You can
|
||||
make an action globally available using :meth:`AdminSite.add_action()`. For
|
||||
make an action globally available using :meth:`AdminSite.add_action`. For
|
||||
example::
|
||||
|
||||
from django.contrib import admin
|
||||
@@ -299,7 +299,7 @@ Making actions available site-wide
|
||||
action named "export_selected_objects". You can explicitly give the action
|
||||
a name -- good if you later want to programmatically :ref:`remove the action
|
||||
<disabling-admin-actions>` -- by passing a second argument to
|
||||
:meth:`AdminSite.add_action()`::
|
||||
:meth:`AdminSite.add_action`::
|
||||
|
||||
admin.site.add_action(export_selected_objects, "export_selected")
|
||||
|
||||
@@ -318,7 +318,7 @@ Disabling a site-wide action
|
||||
.. method:: AdminSite.disable_action(name)
|
||||
|
||||
If you need to disable a :ref:`site-wide action <adminsite-actions>` you can
|
||||
call :meth:`AdminSite.disable_action()`.
|
||||
call :meth:`AdminSite.disable_action`.
|
||||
|
||||
For example, you can use this method to remove the built-in "delete selected
|
||||
objects" action::
|
||||
|
||||
@@ -154,12 +154,12 @@ application and imports it.
|
||||
.. class:: apps.AdminConfig
|
||||
|
||||
This is the default :class:`~django.apps.AppConfig` class for the admin.
|
||||
It calls :func:`~django.contrib.admin.autodiscover()` when Django starts.
|
||||
It calls :func:`~django.contrib.admin.autodiscover` when Django starts.
|
||||
|
||||
.. class:: apps.SimpleAdminConfig
|
||||
|
||||
This class works like :class:`~django.contrib.admin.apps.AdminConfig`,
|
||||
except it doesn't call :func:`~django.contrib.admin.autodiscover()`.
|
||||
except it doesn't call :func:`~django.contrib.admin.autodiscover`.
|
||||
|
||||
.. attribute:: default_site
|
||||
|
||||
@@ -3119,7 +3119,7 @@ Hooking ``AdminSite`` instances into your URLconf
|
||||
The last step in setting up the Django admin is to hook your ``AdminSite``
|
||||
instance into your URLconf. Do this by pointing a given URL at the
|
||||
``AdminSite.urls`` method. It is not necessary to use
|
||||
:func:`~django.urls.include()`.
|
||||
:func:`~django.urls.include`.
|
||||
|
||||
In this example, we register the default ``AdminSite`` instance
|
||||
``django.contrib.admin.site`` at the URL ``/admin/`` ::
|
||||
@@ -3245,10 +3245,10 @@ Adding views to admin sites
|
||||
---------------------------
|
||||
|
||||
Just like :class:`ModelAdmin`, :class:`AdminSite` provides a
|
||||
:meth:`~django.contrib.admin.ModelAdmin.get_urls()` method
|
||||
:meth:`~django.contrib.admin.ModelAdmin.get_urls` method
|
||||
that can be overridden to define additional views for the site. To add
|
||||
a new view to your admin site, extend the base
|
||||
:meth:`~django.contrib.admin.ModelAdmin.get_urls()` method to include
|
||||
:meth:`~django.contrib.admin.ModelAdmin.get_urls` method to include
|
||||
a pattern for your new view.
|
||||
|
||||
.. note::
|
||||
|
||||
@@ -159,7 +159,7 @@ Methods
|
||||
|
||||
When the ``raw_password`` is ``None``, the password will be set to an
|
||||
unusable password, as if
|
||||
:meth:`~django.contrib.auth.models.User.set_unusable_password()`
|
||||
:meth:`~django.contrib.auth.models.User.set_unusable_password`
|
||||
were used.
|
||||
|
||||
.. method:: check_password(raw_password)
|
||||
@@ -176,7 +176,7 @@ Methods
|
||||
Marks the user as having no password set by updating the metadata in
|
||||
the :attr:`~django.contrib.auth.models.User.password` field. This isn't
|
||||
the same as having a blank string for a password.
|
||||
:meth:`~django.contrib.auth.models.User.check_password()` for this user
|
||||
:meth:`~django.contrib.auth.models.User.check_password` for this user
|
||||
will never return ``True``. Doesn't save the
|
||||
:class:`~django.contrib.auth.models.User` object.
|
||||
|
||||
@@ -192,7 +192,7 @@ Methods
|
||||
.. method:: has_usable_password()
|
||||
|
||||
Returns ``False`` if
|
||||
:meth:`~django.contrib.auth.models.User.set_unusable_password()` has
|
||||
:meth:`~django.contrib.auth.models.User.set_unusable_password` has
|
||||
been called for this user.
|
||||
|
||||
.. method:: get_user_permissions(obj=None)
|
||||
@@ -293,7 +293,7 @@ Methods
|
||||
|
||||
Sends an email to the user. If ``from_email`` is ``None``, Django uses
|
||||
the :setting:`DEFAULT_FROM_EMAIL`. Any ``**kwargs`` are passed to the
|
||||
underlying :meth:`~django.core.mail.send_mail()` call.
|
||||
underlying :meth:`~django.core.mail.send_mail` call.
|
||||
|
||||
Manager methods
|
||||
---------------
|
||||
@@ -319,7 +319,7 @@ Manager methods
|
||||
:attr:`~django.contrib.auth.models.User.is_active` set to ``True``.
|
||||
|
||||
If no password is provided,
|
||||
:meth:`~django.contrib.auth.models.User.set_unusable_password()` will
|
||||
:meth:`~django.contrib.auth.models.User.set_unusable_password` will
|
||||
be called.
|
||||
|
||||
If no email is provided, :attr:`~django.contrib.auth.models.User.email`
|
||||
@@ -380,7 +380,7 @@ Manager methods
|
||||
* :ref:`id <automatic-primary-key-fields>` is always ``None``.
|
||||
* :attr:`~django.contrib.auth.models.User.username` is always the empty
|
||||
string.
|
||||
* :meth:`~django.contrib.auth.models.User.get_username()` always returns
|
||||
* :meth:`~django.contrib.auth.models.User.get_username` always returns
|
||||
the empty string.
|
||||
* :attr:`~django.contrib.auth.models.User.is_anonymous` is ``True``
|
||||
instead of ``False``.
|
||||
@@ -393,10 +393,10 @@ Manager methods
|
||||
* :attr:`~django.contrib.auth.models.User.groups` and
|
||||
:attr:`~django.contrib.auth.models.User.user_permissions` are always
|
||||
empty.
|
||||
* :meth:`~django.contrib.auth.models.User.set_password()`,
|
||||
:meth:`~django.contrib.auth.models.User.check_password()`,
|
||||
* :meth:`~django.contrib.auth.models.User.set_password`,
|
||||
:meth:`~django.contrib.auth.models.User.check_password`,
|
||||
:meth:`~django.db.models.Model.save` and
|
||||
:meth:`~django.db.models.Model.delete()` raise :exc:`NotImplementedError`.
|
||||
:meth:`~django.db.models.Model.delete` raise :exc:`NotImplementedError`.
|
||||
|
||||
In practice, you probably won't need to use
|
||||
:class:`~django.contrib.auth.models.AnonymousUser` objects on your own, but
|
||||
@@ -524,7 +524,7 @@ can be used for notification when a user logs in or out.
|
||||
|
||||
``credentials``
|
||||
A dictionary of keyword arguments containing the user credentials that were
|
||||
passed to :func:`~django.contrib.auth.authenticate()` or your own custom
|
||||
passed to :func:`~django.contrib.auth.authenticate` or your own custom
|
||||
authentication backend. Credentials matching a set of 'sensitive' patterns,
|
||||
(including password) will not be sent in the clear as part of the signal.
|
||||
|
||||
|
||||
@@ -220,7 +220,7 @@ The ``ContentTypeManager``
|
||||
referenced via a :ref:`natural key<topics-serialization-natural-keys>`
|
||||
during deserialization.
|
||||
|
||||
The :meth:`~ContentTypeManager.get_for_model()` method is especially
|
||||
The :meth:`~ContentTypeManager.get_for_model` method is especially
|
||||
useful when you know you need to work with a
|
||||
:class:`ContentType <django.contrib.contenttypes.models.ContentType>` but don't
|
||||
want to go to the trouble of obtaining the model's metadata to perform a manual
|
||||
|
||||
@@ -32,7 +32,7 @@ the current statement. This is a complement to
|
||||
:class:`django.db.models.functions.Now`, which returns the date and time of the
|
||||
current statement.
|
||||
|
||||
Note that only the outermost call to :func:`~django.db.transaction.atomic()`
|
||||
Note that only the outermost call to :func:`~django.db.transaction.atomic`
|
||||
sets up a transaction and thus sets the time that ``TransactionNow()`` will
|
||||
return; nested calls create savepoints which do not affect the transaction
|
||||
time.
|
||||
|
||||
@@ -121,7 +121,7 @@ Note:
|
||||
attributes corresponding to ``<changefreq>`` and ``<priority>`` elements,
|
||||
respectively. They can be made callable as functions, as
|
||||
:attr:`~Sitemap.lastmod` was in the example.
|
||||
* :attr:`~Sitemap.items()` is a method that returns a :term:`sequence` or
|
||||
* :attr:`~Sitemap.items` is a method that returns a :term:`sequence` or
|
||||
``QuerySet`` of objects. The objects returned will get passed to any callable
|
||||
methods corresponding to a sitemap property (:attr:`~Sitemap.location`,
|
||||
:attr:`~Sitemap.lastmod`, :attr:`~Sitemap.changefreq`, and
|
||||
@@ -129,7 +129,7 @@ Note:
|
||||
* :attr:`~Sitemap.lastmod` should return a :class:`~datetime.datetime`.
|
||||
* There is no :attr:`~Sitemap.location` method in this example, but you
|
||||
can provide it in order to specify the URL for your object. By default,
|
||||
:attr:`~Sitemap.location()` calls ``get_absolute_url()`` on each object
|
||||
:attr:`~Sitemap.location` calls ``get_absolute_url()`` on each object
|
||||
and returns the result.
|
||||
|
||||
``Sitemap`` class reference
|
||||
@@ -144,19 +144,19 @@ Note:
|
||||
**Required.** A method that returns a :term:`sequence` or ``QuerySet``
|
||||
of objects. The framework doesn't care what *type* of objects they are;
|
||||
all that matters is that these objects get passed to the
|
||||
:attr:`~Sitemap.location()`, :attr:`~Sitemap.lastmod()`,
|
||||
:attr:`~Sitemap.changefreq()` and :attr:`~Sitemap.priority()` methods.
|
||||
:attr:`~Sitemap.location`, :attr:`~Sitemap.lastmod`,
|
||||
:attr:`~Sitemap.changefreq` and :attr:`~Sitemap.priority` methods.
|
||||
|
||||
.. attribute:: Sitemap.location
|
||||
|
||||
**Optional.** Either a method or attribute.
|
||||
|
||||
If it's a method, it should return the absolute path for a given object
|
||||
as returned by :attr:`~Sitemap.items()`.
|
||||
as returned by :attr:`~Sitemap.items`.
|
||||
|
||||
If it's an attribute, its value should be a string representing an
|
||||
absolute path to use for *every* object returned by
|
||||
:attr:`~Sitemap.items()`.
|
||||
:attr:`~Sitemap.items`.
|
||||
|
||||
In both cases, "absolute path" means a URL that doesn't include the
|
||||
protocol or domain. Examples:
|
||||
@@ -167,7 +167,7 @@ Note:
|
||||
|
||||
If :attr:`~Sitemap.location` isn't provided, the framework will call
|
||||
the ``get_absolute_url()`` method on each object as returned by
|
||||
:attr:`~Sitemap.items()`.
|
||||
:attr:`~Sitemap.items`.
|
||||
|
||||
To specify a protocol other than ``'http'``, use
|
||||
:attr:`~Sitemap.protocol`.
|
||||
@@ -177,12 +177,12 @@ Note:
|
||||
**Optional.** Either a method or attribute.
|
||||
|
||||
If it's a method, it should take one argument -- an object as returned
|
||||
by :attr:`~Sitemap.items()` -- and return that object's last-modified
|
||||
by :attr:`~Sitemap.items` -- and return that object's last-modified
|
||||
date/time as a :class:`~datetime.datetime`.
|
||||
|
||||
If it's an attribute, its value should be a :class:`~datetime.datetime`
|
||||
representing the last-modified date/time for *every* object returned by
|
||||
:attr:`~Sitemap.items()`.
|
||||
:attr:`~Sitemap.items`.
|
||||
|
||||
If all items in a sitemap have a :attr:`~Sitemap.lastmod`, the sitemap
|
||||
generated by :func:`views.sitemap` will have a ``Last-Modified``
|
||||
@@ -196,7 +196,7 @@ Note:
|
||||
**Optional.**
|
||||
|
||||
This property returns a :class:`~django.core.paginator.Paginator` for
|
||||
:attr:`~Sitemap.items()`. If you generate sitemaps in a batch you may
|
||||
:attr:`~Sitemap.items`. If you generate sitemaps in a batch you may
|
||||
want to override this as a cached property in order to avoid multiple
|
||||
``items()`` calls.
|
||||
|
||||
@@ -205,11 +205,11 @@ Note:
|
||||
**Optional.** Either a method or attribute.
|
||||
|
||||
If it's a method, it should take one argument -- an object as returned
|
||||
by :attr:`~Sitemap.items()` -- and return that object's change
|
||||
by :attr:`~Sitemap.items` -- and return that object's change
|
||||
frequency as a string.
|
||||
|
||||
If it's an attribute, its value should be a string representing the
|
||||
change frequency of *every* object returned by :attr:`~Sitemap.items()`.
|
||||
change frequency of *every* object returned by :attr:`~Sitemap.items`.
|
||||
|
||||
Possible values for :attr:`~Sitemap.changefreq`, whether you use a
|
||||
method or attribute, are:
|
||||
@@ -227,12 +227,12 @@ Note:
|
||||
**Optional.** Either a method or attribute.
|
||||
|
||||
If it's a method, it should take one argument -- an object as returned
|
||||
by :attr:`~Sitemap.items()` -- and return that object's priority as
|
||||
by :attr:`~Sitemap.items` -- and return that object's priority as
|
||||
either a string or float.
|
||||
|
||||
If it's an attribute, its value should be either a string or float
|
||||
representing the priority of *every* object returned by
|
||||
:attr:`~Sitemap.items()`.
|
||||
:attr:`~Sitemap.items`.
|
||||
|
||||
Example values for :attr:`~Sitemap.priority`: ``0.4``, ``1.0``. The
|
||||
default priority of a page is ``0.5``. See the `sitemaps.org
|
||||
@@ -554,7 +554,7 @@ URL. Each alternate is a dictionary with ``location`` and ``lang_code`` keys.
|
||||
|
||||
The ``item`` attribute has been added for each URL to allow more flexible
|
||||
customization of the templates, such as `Google news sitemaps`_. Assuming
|
||||
Sitemap's :attr:`~Sitemap.items()` would return a list of items with
|
||||
Sitemap's :attr:`~Sitemap.items` would return a list of items with
|
||||
``publication_data`` and a ``tags`` field something like this would
|
||||
generate a Google News compatible sitemap:
|
||||
|
||||
|
||||
@@ -485,7 +485,7 @@ a fallback when the database-backed sites framework is not available.
|
||||
|
||||
A :class:`~django.contrib.sites.requests.RequestSite` object has a similar
|
||||
interface to a normal :class:`~django.contrib.sites.models.Site` object,
|
||||
except its :meth:`~django.contrib.sites.requests.RequestSite.__init__()`
|
||||
except its :meth:`~django.contrib.sites.requests.RequestSite.__init__`
|
||||
method takes an :class:`~django.http.HttpRequest` object. It's able to deduce
|
||||
the ``domain`` and ``name`` by looking at the request's domain. It has
|
||||
``save()`` and ``delete()`` methods to match the interface of
|
||||
|
||||
@@ -311,7 +311,7 @@ Language
|
||||
|
||||
Feeds created by the syndication framework automatically include the
|
||||
appropriate ``<language>`` tag (RSS 2.0) or ``xml:lang`` attribute (Atom). By
|
||||
default, this is :func:`django.utils.translation.get_language()`. You can change it
|
||||
default, this is :func:`django.utils.translation.get_language`. You can change it
|
||||
by setting the ``language`` class attribute.
|
||||
|
||||
URLs
|
||||
|
||||
Reference in New Issue
Block a user