mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed broken links, round 3. refs #19516
This commit is contained in:
@@ -11,12 +11,12 @@ The built-in comment models
|
||||
|
||||
.. attribute:: content_object
|
||||
|
||||
A :class:`~django.contrib.contettypes.generic.GenericForeignKey`
|
||||
A :class:`~django.contrib.contenttypes.generic.GenericForeignKey`
|
||||
attribute pointing to the object the comment is attached to. You can use
|
||||
this to get at the related object (i.e. ``my_comment.content_object``).
|
||||
|
||||
Since this field is a
|
||||
:class:`~django.contrib.contettypes.generic.GenericForeignKey`, it's
|
||||
:class:`~django.contrib.contenttypes.generic.GenericForeignKey`, it's
|
||||
actually syntactic sugar on top of two underlying attributes, described
|
||||
below.
|
||||
|
||||
@@ -77,4 +77,3 @@ The built-in comment models
|
||||
|
||||
``True`` if the comment was removed. Used to keep track of removed
|
||||
comments instead of just deleting them.
|
||||
|
||||
|
||||
@@ -81,8 +81,8 @@ Built-in moderation options
|
||||
.. attribute:: auto_close_field
|
||||
|
||||
If this is set to the name of a
|
||||
:class:`~django.db.models.fields.DateField` or
|
||||
:class:`~django.db.models.fields.DateTimeField` on the model for which
|
||||
:class:`~django.db.models.DateField` or
|
||||
:class:`~django.db.models.DateTimeField` on the model for which
|
||||
comments are being moderated, new comments for objects of that model
|
||||
will be disallowed (immediately deleted) when a certain number of days
|
||||
have passed after the date specified in that field. Must be
|
||||
@@ -117,7 +117,7 @@ Built-in moderation options
|
||||
.. attribute:: enable_field
|
||||
|
||||
If this is set to the name of a
|
||||
:class:`~django.db.models.fields.BooleanField` on the model
|
||||
:class:`~django.db.models.BooleanField` on the model
|
||||
for which comments are being moderated, new comments on
|
||||
objects of that model will be disallowed (immediately deleted)
|
||||
whenever the value of that field is ``False`` on the object
|
||||
|
||||
@@ -234,13 +234,15 @@ lookup::
|
||||
|
||||
.. versionadded:: 1.5
|
||||
|
||||
Prior to Django 1.5 :meth:`~ContentTypeManager.get_for_model()` and
|
||||
:meth:`~ContentTypeManager.get_for_models()` always returned the
|
||||
:class:`~django.contrib.contenttypes.models.ContentType` associated with the
|
||||
concrete model of the specified one(s). That means there was no way to retreive
|
||||
the :class:`~django.contrib.contenttypes.models.ContentType` of a proxy model
|
||||
Prior to Django 1.5,
|
||||
:meth:`~django.contrib.contenttypes.models.ContentTypeManager.get_for_model` and
|
||||
:meth:`~django.contrib.contenttypes.models.ContentTypeManager.get_for_models`
|
||||
always returned the :class:`~django.contrib.contenttypes.models.ContentType`
|
||||
associated with the concrete model of the specified one(s). That means there
|
||||
was no way to retreive the
|
||||
:class:`~django.contrib.contenttypes.models.ContentType` of a proxy model
|
||||
using those methods. As of Django 1.5 you can now pass a boolean flag –
|
||||
respectively ``for_concrete_model`` and ``for_concrete_models`` – to specify
|
||||
``for_concrete_model`` and ``for_concrete_models`` respectively – to specify
|
||||
wether or not you want to retreive the
|
||||
:class:`~django.contrib.contenttypes.models.ContentType` for the concrete or
|
||||
direct model.
|
||||
|
||||
@@ -150,11 +150,11 @@ it's not necessary to include every field in your form. For example::
|
||||
These values are only displayed for unbound forms, and they're not used as
|
||||
fallback values if a particular value isn't provided.
|
||||
|
||||
Note that if a :class:`~django.forms.fields.Field` defines
|
||||
:attr:`~Form.initial` *and* you include ``initial`` when instantiating the
|
||||
``Form``, then the latter ``initial`` will have precedence. In this example,
|
||||
``initial`` is provided both at the field level and at the form instance level,
|
||||
and the latter gets precedence::
|
||||
Note that if a :class:`~django.forms.Field` defines :attr:`~Form.initial` *and*
|
||||
you include ``initial`` when instantiating the ``Form``, then the latter
|
||||
``initial`` will have precedence. In this example, ``initial`` is provided both
|
||||
at the field level and at the form instance level, and the latter gets
|
||||
precedence::
|
||||
|
||||
>>> class CommentForm(forms.Form):
|
||||
... name = forms.CharField(initial='class')
|
||||
|
||||
@@ -885,7 +885,7 @@ Slightly complex built-in ``Field`` classes
|
||||
.. attribute:: MultiValueField.widget
|
||||
|
||||
Must be a subclass of :class:`django.forms.MultiWidget`.
|
||||
Default value is :class:`~django.forms.widgets.TextInput`, which
|
||||
Default value is :class:`~django.forms.TextInput`, which
|
||||
probably is not very useful in this case.
|
||||
|
||||
.. method:: compress(data_list)
|
||||
|
||||
@@ -49,8 +49,8 @@ Setting arguments for widgets
|
||||
|
||||
Many widgets have optional extra arguments; they can be set when defining the
|
||||
widget on the field. In the following example, the
|
||||
:attr:`~SelectDateWidget.years` attribute is set for a
|
||||
:class:`~django.forms.extras.widgets.SelectDateWidget`::
|
||||
:attr:`~django.forms.extras.widgets.SelectDateWidget.years` attribute is set
|
||||
for a :class:`~django.forms.extras.widgets.SelectDateWidget`::
|
||||
|
||||
from django.forms.fields import DateField, ChoiceField, MultipleChoiceField
|
||||
from django.forms.widgets import RadioSelect, CheckboxSelectMultiple
|
||||
@@ -222,7 +222,7 @@ foundation for custom widgets.
|
||||
.. class:: MultiWidget(widgets, attrs=None)
|
||||
|
||||
A widget that is composed of multiple widgets.
|
||||
:class:`~django.forms.widgets.MultiWidget` works hand in hand with the
|
||||
:class:`~django.forms.MultiWidget` works hand in hand with the
|
||||
:class:`~django.forms.MultiValueField`.
|
||||
|
||||
:class:`MultiWidget` has one required argument:
|
||||
@@ -246,8 +246,8 @@ foundation for custom widgets.
|
||||
the combined value of the form field into the values for each widget.
|
||||
|
||||
An example of this is how :class:`SplitDateTimeWidget` turns a
|
||||
:class:`datetime` value into a list with date and time split into two
|
||||
separate values::
|
||||
:class:`~datetime.datetime` value into a list with date and time split
|
||||
into two separate values::
|
||||
|
||||
class SplitDateTimeWidget(MultiWidget):
|
||||
|
||||
|
||||
@@ -547,8 +547,7 @@ Also has one optional argument:
|
||||
Optional. A storage object, which handles the storage and retrieval of your
|
||||
files. See :doc:`/topics/files` for details on how to provide this object.
|
||||
|
||||
The default form widget for this field is a
|
||||
:class:`~django.forms.widgets.FileInput`.
|
||||
The default form widget for this field is a :class:`~django.forms.FileInput`.
|
||||
|
||||
Using a :class:`FileField` or an :class:`ImageField` (see below) in a model
|
||||
takes a few steps:
|
||||
@@ -590,7 +589,7 @@ topic guide.
|
||||
saved.
|
||||
|
||||
The uploaded file's relative URL can be obtained using the
|
||||
:attr:`~django.db.models.fields.FileField.url` attribute. Internally,
|
||||
:attr:`~django.db.models.FileField.url` attribute. Internally,
|
||||
this calls the :meth:`~django.core.files.storage.Storage.url` method of the
|
||||
underlying :class:`~django.core.files.storage.Storage` class.
|
||||
|
||||
|
||||
@@ -659,7 +659,7 @@ For every :class:`~django.db.models.DateField` and
|
||||
<django.db.models.Field.null>`, the object will have ``get_next_by_FOO()`` and
|
||||
``get_previous_by_FOO()`` methods, where ``FOO`` is the name of the field. This
|
||||
returns the next and previous object with respect to the date field, raising
|
||||
a :exc:`~django.db.DoesNotExist` exception when appropriate.
|
||||
a :exc:`~django.core.exceptions.DoesNotExist` exception when appropriate.
|
||||
|
||||
Both methods accept optional keyword arguments, which should be in the format
|
||||
described in :ref:`Field lookups <field-lookups>`.
|
||||
|
||||
@@ -1112,9 +1112,9 @@ one, doing so will result in an error.
|
||||
|
||||
.. note::
|
||||
|
||||
When calling :meth:`~Model.save()` for instances with deferred fields,
|
||||
only the loaded fields will be saved. See :meth:`~Model.save()` for more
|
||||
details.
|
||||
When calling :meth:`~django.db.models.Model.save()` for instances with
|
||||
deferred fields, only the loaded fields will be saved. See
|
||||
:meth:`~django.db.models.Model.save()` for more details.
|
||||
|
||||
|
||||
only
|
||||
@@ -1164,9 +1164,9 @@ using :meth:`select_related` is an error as well.
|
||||
|
||||
.. note::
|
||||
|
||||
When calling :meth:`~Model.save()` for instances with deferred fields,
|
||||
only the loaded fields will be saved. See :meth:`~Model.save()` for more
|
||||
details.
|
||||
When calling :meth:`~django.db.models.Model.save()` for instances with
|
||||
deferred fields, only the loaded fields will be saved. See
|
||||
:meth:`~django.db.models.Model.save()` for more details.
|
||||
|
||||
using
|
||||
~~~~~
|
||||
@@ -1248,7 +1248,7 @@ the format described in `Field lookups`_.
|
||||
|
||||
``get()`` raises :exc:`~django.core.exceptions.MultipleObjectsReturned` if more
|
||||
than one object was found. The
|
||||
:exc:`~django.core.excpetions.MultipleObjectsReturned` exception is an
|
||||
:exc:`~django.core.exceptions.MultipleObjectsReturned` exception is an
|
||||
attribute of the model class.
|
||||
|
||||
``get()`` raises a :exc:`~django.core.exceptions.DoesNotExist` exception if an
|
||||
|
||||
@@ -212,24 +212,24 @@ m2m_changed
|
||||
.. data:: django.db.models.signals.m2m_changed
|
||||
:module:
|
||||
|
||||
Sent when a :class:`ManyToManyField` is changed on a model instance.
|
||||
Strictly speaking, this is not a model signal since it is sent by the
|
||||
:class:`ManyToManyField`, but since it complements the
|
||||
Sent when a :class:`~django.db.models.ManyToManyField` is changed on a model
|
||||
instance. Strictly speaking, this is not a model signal since it is sent by the
|
||||
:class:`~django.db.models.ManyToManyField`, but since it complements the
|
||||
:data:`pre_save`/:data:`post_save` and :data:`pre_delete`/:data:`post_delete`
|
||||
when it comes to tracking changes to models, it is included here.
|
||||
|
||||
Arguments sent with this signal:
|
||||
|
||||
``sender``
|
||||
The intermediate model class describing the :class:`ManyToManyField`.
|
||||
This class is automatically created when a many-to-many field is
|
||||
defined; you can access it using the ``through`` attribute on the
|
||||
many-to-many field.
|
||||
The intermediate model class describing the
|
||||
:class:`~django.db.models.ManyToManyField`. This class is automatically
|
||||
created when a many-to-many field is defined; you can access it using the
|
||||
``through`` attribute on the many-to-many field.
|
||||
|
||||
``instance``
|
||||
The instance whose many-to-many relation is updated. This can be an
|
||||
instance of the ``sender``, or of the class the :class:`ManyToManyField`
|
||||
is related to.
|
||||
instance of the ``sender``, or of the class the
|
||||
:class:`~django.db.models.ManyToManyField` is related to.
|
||||
|
||||
``action``
|
||||
A string indicating the type of update that is done on the relation.
|
||||
@@ -303,8 +303,9 @@ Argument Value
|
||||
|
||||
``action`` ``"pre_add"`` (followed by a separate signal with ``"post_add"``)
|
||||
|
||||
``reverse`` ``False`` (``Pizza`` contains the :class:`ManyToManyField`,
|
||||
so this call modifies the forward relation)
|
||||
``reverse`` ``False`` (``Pizza`` contains the
|
||||
:class:`~django.db.models.ManyToManyField`, so this call
|
||||
modifies the forward relation)
|
||||
|
||||
``model`` ``Topping`` (the class of the objects added to the
|
||||
``Pizza``)
|
||||
@@ -329,8 +330,9 @@ Argument Value
|
||||
|
||||
``action`` ``"pre_remove"`` (followed by a separate signal with ``"post_remove"``)
|
||||
|
||||
``reverse`` ``True`` (``Pizza`` contains the :class:`ManyToManyField`,
|
||||
so this call modifies the reverse relation)
|
||||
``reverse`` ``True`` (``Pizza`` contains the
|
||||
:class:`~django.db.models.ManyToManyField`, so this call
|
||||
modifies the reverse relation)
|
||||
|
||||
``model`` ``Pizza`` (the class of the objects removed from the
|
||||
``Topping``)
|
||||
|
||||
@@ -864,7 +864,7 @@ an attribute "description," you could use::
|
||||
{% regroup cities by country.description as country_list %}
|
||||
|
||||
Or, if ``country`` is a field with ``choices``, it will have a
|
||||
:meth:`^django.db.models.Model.get_FOO_display` method available as an
|
||||
:meth:`~django.db.models.Model.get_FOO_display` method available as an
|
||||
attribute, allowing you to group on the display string rather than the
|
||||
``choices`` key::
|
||||
|
||||
|
||||
@@ -145,8 +145,8 @@ results. Instead do::
|
||||
|
||||
The functions defined in this module share the following properties:
|
||||
|
||||
- They raise :exc:`ValueError` if their input is well formatted but isn't a
|
||||
valid date or time.
|
||||
- They raise :exc:`~exceptions.ValueError` if their input is well formatted but
|
||||
isn't a valid date or time.
|
||||
- They return ``None`` if it isn't well formatted at all.
|
||||
- They accept up to picosecond resolution in input, but they truncate it to
|
||||
microseconds, since that's what Python supports.
|
||||
|
||||
Reference in New Issue
Block a user