Ticket #17528: 17528.diff

File 17528.diff, 1.7 KB (added by Tim Graham, 11 years ago)
  • docs/ref/models/relations.txt

    diff --git a/docs/ref/models/relations.txt b/docs/ref/models/relations.txt
    index ffebe37..c561625 100644
    a b Related objects reference  
    4848            >>> e = Entry.objects.get(id=234)
    4949            >>> b.entry_set.add(e) # Associates Entry e with Blog b.
    5050
     51        In the example above, ``e.save()`` is called to perform the update.
     52        Using ``add()`` with a many-to-many relationship, however, will not
     53        call any ``save()`` methods, but rather fire the
     54        :data:`~django.db.models.signals.m2m_changed` signal. The relationships
     55        are created using :meth:`QuerySet.bulk_create
     56        <django.db.models.query.QuerySet.bulk_create>`.
     57
    5158    .. method:: create(**kwargs)
    5259
    5360        Creates a new object, saves it and puts it in the related object set.
    Related objects reference  
    8693            >>> e = Entry.objects.get(id=234)
    8794            >>> b.entry_set.remove(e) # Disassociates Entry e from Blog b.
    8895
     96        Similar to :meth:`add()`, ``e.save()`` would be called in the example
     97        above to perform the update. Using ``remove()`` with a many-to-many
     98        relationship, however, will delete the relationships using
     99        :meth:`QuerySet.delete<django.db.models.query.QuerySet.delete>` which
     100        means no model ``save()`` methods are called; rather the
     101        :data:`~django.db.models.signals.m2m_changed` signal will be fired.
     102
    89103        For :class:`~django.db.models.ForeignKey` objects, this method only
    90104        exists if ``null=True``. If the related field can't be set to ``None``
    91105        (``NULL``), then an object can't be removed from a relation without
Back to Top