#28514: Clarify docs regarding idempotence of RelatedManager.add()
--------------------------------------+------------------------------------
     Reporter:  Дилян Палаузов        |                    Owner:  nobody
         Type:  Cleanup/optimization  |                   Status:  new
    Component:  Documentation         |                  Version:  1.11
     Severity:  Normal                |               Resolution:
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  0                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  1                     |                    UI/UX:  0
--------------------------------------+------------------------------------
Changes (by Tim Graham):

 * easy:  0 => 1
 * stage:  Unreviewed => Accepted


Old description:

> At
> https://docs.djangoproject.com/en/1.11/topics/db/examples/many_to_many/
> is written:
>
> >> a2.publications.add(p3)
> >
> > Adding a second time is OK:
> >
> >> a2.publications.add(p3)
>
> Please rephrase it to "Adding a second time is OK, it doesn't duplicate
> the relation".
>

> At https://docs.djangoproject.com/en/1.11/ref/models/relations/ is
> written:
>
>  add(*objs, bulk=True)
>  Adds the specified model objects to the related object set.
>
> Please amend: "Inserting existing relations this way does not cause
> problems."
>
> The purpose of the changes is to make clear, that add() is idempotent and
> it is not necessary first to read the data from the database, join with
> the new values and eventually write the resulting set back.

New description:

 At https://docs.djangoproject.com/en/1.11/topics/db/examples/many_to_many/
 it's written:
 {{{
 >> a2.publications.add(p3)
 >
 > Adding a second time is OK:
 >
 >> a2.publications.add(p3)
 }}}
 Please rephrase it to "Adding a second time is OK, it doesn't duplicate
 the relation".

 At https://docs.djangoproject.com/en/1.11/ref/models/relations/ it's
 written:
 {{{
  add(*objs, bulk=True)
  Adds the specified model objects to the related object set.
 }}}
 Please amend: "Inserting existing relations this way does not cause
 problems."

 The purpose of the changes is to make clear, that `add()` is idempotent
 and it is not necessary first to read the data from the database, join
 with the new values and eventually write the resulting set back.

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28514#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/072.4dd0225cb492f155e06b061963676ffc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to