1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Avoided counting attributes and methods in docs.

This commit is contained in:
Mariusz Felisiak
2021-12-28 12:36:57 +01:00
committed by GitHub
parent b13d920b7b
commit ad6bb20557
8 changed files with 37 additions and 49 deletions

View File

@@ -569,12 +569,10 @@ A field to store raw binary data. It can be assigned :class:`bytes`,
By default, ``BinaryField`` sets :attr:`~Field.editable` to ``False``, in which
case it can't be included in a :class:`~django.forms.ModelForm`.
``BinaryField`` has one extra optional argument:
.. attribute:: BinaryField.max_length
The maximum length (in bytes) of the field. The maximum length is enforced
in Django's validation using
Optional. The maximum length (in bytes) of the field. The maximum length is
enforced in Django's validation using
:class:`~django.core.validators.MaxLengthValidator`.
.. admonition:: Abusing ``BinaryField``
@@ -607,7 +605,7 @@ For large amounts of text, use :class:`~django.db.models.TextField`.
The default form widget for this field is a :class:`~django.forms.TextInput`.
:class:`CharField` has two extra arguments:
:class:`CharField` has the following extra arguments:
.. attribute:: CharField.max_length
@@ -713,7 +711,7 @@ A fixed-precision decimal number, represented in Python by a
:class:`~decimal.Decimal` instance. It validates the input using
:class:`~django.core.validators.DecimalValidator`.
Has two **required** arguments:
Has the following **required** arguments:
.. attribute:: DecimalField.max_digits
@@ -781,7 +779,7 @@ A file-upload field.
The ``primary_key`` argument isn't supported and will raise an error if
used.
Has two optional arguments:
Has the following optional arguments:
.. attribute:: FileField.upload_to
@@ -1153,8 +1151,8 @@ validates that the uploaded object is a valid image.
In addition to the special attributes that are available for :class:`FileField`,
an :class:`ImageField` also has ``height`` and ``width`` attributes.
To facilitate querying on those attributes, :class:`ImageField` has two extra
optional arguments:
To facilitate querying on those attributes, :class:`ImageField` has the
following optional arguments:
.. attribute:: ImageField.height_field

View File

@@ -147,7 +147,7 @@ Here's the formal declaration of a ``QuerySet``:
``QuerySet`` methods return new querysets. These methods are covered in
detail later in this section.
The ``QuerySet`` class has two public attributes you can use for
The ``QuerySet`` class has the following public attributes you can use for
introspection:
.. attribute:: ordered
@@ -3599,13 +3599,11 @@ by the aggregate.
* Return type: ``float`` if input is ``int``, otherwise same as input
field, or ``output_field`` if supplied
Has one optional argument:
.. attribute:: distinct
If ``distinct=True``, ``Avg`` returns the mean value of unique values.
This is the SQL equivalent of ``AVG(DISTINCT <field>)``. The default
value is ``False``.
Optional. If ``distinct=True``, ``Avg`` returns the mean value of
unique values. This is the SQL equivalent of ``AVG(DISTINCT <field>)``.
The default value is ``False``.
``Count``
~~~~~~~~~
@@ -3618,13 +3616,11 @@ by the aggregate.
* Default alias: ``<field>__count``
* Return type: ``int``
Has one optional argument:
.. attribute:: distinct
If ``distinct=True``, the count will only include unique instances.
This is the SQL equivalent of ``COUNT(DISTINCT <field>)``. The default
value is ``False``.
Optional. If ``distinct=True``, the count will only include unique
instances. This is the SQL equivalent of ``COUNT(DISTINCT <field>)``.
The default value is ``False``.
.. note::
@@ -3661,12 +3657,11 @@ by the aggregate.
* Return type: ``float`` if input is ``int``, otherwise same as input
field, or ``output_field`` if supplied
Has one optional argument:
.. attribute:: sample
By default, ``StdDev`` returns the population standard deviation. However,
if ``sample=True``, the return value will be the sample standard deviation.
Optional. By default, ``StdDev`` returns the population standard
deviation. However, if ``sample=True``, the return value will be the
sample standard deviation.
``Sum``
~~~~~~~
@@ -3678,13 +3673,11 @@ by the aggregate.
* Default alias: ``<field>__sum``
* Return type: same as input field, or ``output_field`` if supplied
Has one optional argument:
.. attribute:: distinct
If ``distinct=True``, ``Sum`` returns the sum of unique values. This is
the SQL equivalent of ``SUM(DISTINCT <field>)``. The default value is
``False``.
Optional. If ``distinct=True``, ``Sum`` returns the sum of unique
values. This is the SQL equivalent of ``SUM(DISTINCT <field>)``. The
default value is ``False``.
``Variance``
~~~~~~~~~~~~
@@ -3697,12 +3690,11 @@ by the aggregate.
* Return type: ``float`` if input is ``int``, otherwise same as input
field, or ``output_field`` if supplied
Has one optional argument:
.. attribute:: sample
By default, ``Variance`` returns the population variance. However,
if ``sample=True``, the return value will be the sample variance.
Optional. By default, ``Variance`` returns the population variance.
However, if ``sample=True``, the return value will be the sample
variance.
Query-related tools
===================