Fixed #30573 -- Rephrased documentation to avoid words that minimise the involved difficulty.

This patch does not remove all occurrences of the words in question.
Rather, I went through all of the occurrences of the words listed
below, and judged if they a) suggested the reader had some kind of
knowledge/experience, and b) if they added anything of value (including
tone of voice, etc). I left most of the words alone. I looked at the
following words:

- simply/simple
- easy/easier/easiest
- obvious
- just
- merely
- straightforward
- ridiculous

Thanks to Carlton Gibson for guidance on how to approach this issue, and
to Tim Bell for providing the idea. But the enormous lion's share of
thanks go to Adam Johnson for his patient and helpful review.
This commit is contained in:
Tobias Kunze 2019-06-17 16:54:55 +02:00 committed by Mariusz Felisiak
parent addabc492b
commit 4a954cfd11
149 changed files with 1101 additions and 1157 deletions

View file

@ -569,8 +569,8 @@ Adding additional fields to a formset
If you need to add additional fields to the formset this can be easily
accomplished. The formset base class provides an ``add_fields`` method. You
can simply override this method to add your own fields or even redefine the
default fields/attributes of the order and deletion fields::
can override this method to add your own fields or even redefine the default
fields/attributes of the order and deletion fields::
>>> from django.forms import BaseFormSet
>>> from django.forms import formset_factory
@ -651,9 +651,9 @@ This is useful if you want to :ref:`use more than one formset in a view
Using a formset in views and templates
======================================
Using a formset inside a view is as easy as using a regular ``Form`` class.
The only thing you will want to be aware of is making sure to use the
management form inside the template. Let's look at a sample view::
Using a formset inside a view is not very different from using a regular
``Form`` class. The only thing you will want to be aware of is making sure to
use the management form inside the template. Let's look at a sample view::
from django.forms import formset_factory
from django.shortcuts import render

View file

@ -26,11 +26,11 @@ allow a visitor to do things like enter text, select options, manipulate
objects or controls, and so on, and then send that information back to the
server.
Some of these form interface elements - text input or checkboxes - are fairly
simple and are built into HTML itself. Others are much more complex; an
interface that pops up a date picker or allows you to move a slider or
manipulate controls will typically use JavaScript and CSS as well as HTML form
``<input>`` elements to achieve these effects.
Some of these form interface elements - text input or checkboxes - are built
into HTML itself. Others are much more complex; an interface that pops up a
date picker or allows you to move a slider or manipulate controls will
typically use JavaScript and CSS as well as HTML form ``<input>`` elements to
achieve these effects.
As well as its ``<input>`` elements, a form must specify two things:
@ -326,8 +326,7 @@ telling it where to go next.
The template
~~~~~~~~~~~~
We don't need to do much in our ``name.html`` template. The simplest example
is:
We don't need to do much in our ``name.html`` template:
.. code-block:: html+django
@ -671,8 +670,7 @@ Useful attributes on ``{{ field }}`` include:
Outputs a ``<ul class="errorlist">`` containing any validation errors
corresponding to this field. You can customize the presentation of
the errors with a ``{% for error in field.errors %}`` loop. In this
case, each object in the loop is a simple string containing the error
message.
case, each object in the loop is a string containing the error message.
``{{ field.is_hidden }}``
This attribute is ``True`` if the form field is a hidden field and

View file

@ -16,7 +16,7 @@ Calendar widget. This widget can then be associated with the CSS and
JavaScript that is required to render the calendar. When the Calendar
widget is used on a form, Django is able to identify the CSS and
JavaScript files that are required, and provide the list of file names
in a form suitable for easy inclusion on your Web page.
in a form suitable for inclusion on your Web page.
.. admonition:: Assets and Django Admin
@ -49,7 +49,7 @@ The easiest way to define assets is as a static definition. Using this
method, the declaration is an inner ``Media`` class. The properties of the
inner class define the requirements.
Here's a simple example::
Here's an example::
from django import forms
@ -362,8 +362,7 @@ are part of the form::
<script type="text/javascript" src="http://static.example.com/whizbang.js"></script>
If you want to associate additional assets with a form -- for example,
CSS for form layout -- simply add a ``Media`` declaration to the
form::
CSS for form layout -- add a ``Media`` declaration to the form::
>>> class ContactForm(forms.Form):
... date = DateField(widget=CalendarWidget)

View file

@ -389,9 +389,8 @@ you've manually saved the instance produced by the form, you can invoke
>>> f.save_m2m()
Calling ``save_m2m()`` is only required if you use ``save(commit=False)``.
When you use a simple ``save()`` on a form, all data -- including
many-to-many data -- is saved without the need for any additional method calls.
For example:
When you use a ``save()`` on a form, all data -- including many-to-many data --
is saved without the need for any additional method calls. For example:
.. code-block:: python
@ -731,8 +730,8 @@ to make::
>>> from myapp.models import Book
>>> BookForm = modelform_factory(Book, fields=("author", "title"))
This can also be used to make simple modifications to existing forms, for
example by specifying the widgets to be used for a given field::
This can also be used to make modifications to existing forms, for example by
specifying the widgets to be used for a given field::
>>> from django.forms import Textarea
>>> Form = modelform_factory(Book, form=BookForm,
@ -755,8 +754,8 @@ Model formsets
.. class:: models.BaseModelFormSet
Like :doc:`regular formsets </topics/forms/formsets>`, Django provides a couple
of enhanced formset classes that make it easy to work with Django models. Let's
reuse the ``Author`` model from above::
of enhanced formset classes to make working with Django models more
convenient. Let's reuse the ``Author`` model from above::
>>> from django.forms import modelformset_factory
>>> from myapp.models import Author
@ -786,8 +785,8 @@ with the ``Author`` model. It works just like a regular formset::
:func:`~django.forms.models.modelformset_factory` uses
:func:`~django.forms.formsets.formset_factory` to generate formsets. This
means that a model formset is just an extension of a basic formset that
knows how to interact with a particular model.
means that a model formset is an extension of a basic formset that knows
how to interact with a particular model.
Changing the queryset
---------------------
@ -952,7 +951,7 @@ extra forms displayed.
Also, ``extra=0`` doesn't prevent creation of new model instances as you can
:ref:`add additional forms with JavaScript <understanding-the-managementform>`
or just send additional POST data. Formsets `don't yet provide functionality
or send additional POST data. Formsets `don't yet provide functionality
<https://code.djangoproject.com/ticket/26142>`_ for an "edit only" view that
prevents creation of new instances.