Resolved docs lint issues

This commit is contained in:
Anthony Addae 2025-10-20 16:34:53 +00:00
parent f24909081f
commit 9c15d7cd62
3 changed files with 21 additions and 14 deletions

View file

@ -19,7 +19,8 @@ Creating Formsets
It is the base class from which every FormSet class is derived.
Following attributes and methods are available in this class
see the :doc:`topics</topics/forms/formsets>` page for examples on how to use them
see the :doc:`topics</topics/forms/formsets>` page for examples on
how to use them
There are two ways to create formsets in Django:
@ -90,5 +91,4 @@ Declarative ``FormSet``
... can_delete_extra = False
... renderer = None
...

View file

@ -259,14 +259,16 @@ Declarative ``ModelFormSet``
.. class:: ModelFormSet
A BaseModelFormSet subclass that allows declarative declaration of model formsets.
A BaseModelFormSet subclass that allows declarative declaration of
model formsets.
.. versionadded:: 5.1
Returns a ``ModelFormSet`` class for the given ``model`` class.
The same arguments that can be passed to the ``modelformset_factory``
function can also be passed to the declarative syntax.
The same arguments that can be passed to the
``modelformset_factory`` function can also be passed to the
declarative syntax.
See the following example which shows how to create AuthorFormSet from
``Author`` model::
@ -333,15 +335,16 @@ Declarative ``InlineFormSet``
.. class:: InlineFormSet
A BaseInlineFormSet subclass that allows declarative declaration of model formsets.
A BaseInlineFormSet subclass that allows declarative declaration of
model formsets.
.. versionadded:: 5.1
Returns a ``InlineFormSet`` class for the given ``parent_model`` and
``model`` class.
The Declarative ``InlineFormSet`` class takes the same arguments as the
:func:`inlineformset_factory` function.
The Declarative ``InlineFormSet`` class takes the same arguments as
the :func:`inlineformset_factory` function.
.. code-block:: pycon

View file

@ -506,12 +506,14 @@ number of forms should use custom formset validation.
If ``validate_max=True`` is passed to
:func:`~django.forms.formsets.formset_factory`, validation will also check
that the number of forms in the data set, minus those marked for deletion, is
less than or equal to ``max_num``.
that the number of forms in the data set, minus those marked for deletion,
is less than or equal to ``max_num``.
>>> from django.forms import formset_factory
>>> from myapp.forms import ArticleForm
>>> ArticleFormSet = formset_factory(ArticleForm, max_num=1, validate_max=True)
>>> ArticleFormSet = formset_factory(
... ArticleForm, max_num=1, validate_max=True
... )
>>> data = {
... 'form-TOTAL_FORMS': '2',
... 'form-INITIAL_FORMS': '0',
@ -549,12 +551,14 @@ to the :ref:`formsets-error-messages` argument.
If ``validate_min=True`` is passed to
:func:`~django.forms.formsets.formset_factory`, validation will also check
that the number of forms in the data set, minus those marked for deletion, is
greater than or equal to ``min_num``.
that the number of forms in the data set, minus those marked for deletion,
is greater than or equal to ``min_num``.
>>> from django.forms import formset_factory
>>> from myapp.forms import ArticleForm
>>> ArticleFormSet = formset_factory(ArticleForm, min_num=3, validate_min=True)
>>> ArticleFormSet = formset_factory(
... ArticleForm, min_num=3, validate_min=True
... )
>>> data = {
... 'form-TOTAL_FORMS': '2',
... 'form-INITIAL_FORMS': '0',