1
0
mirror of https://github.com/django/django.git synced 2025-07-05 18:29:11 +00:00

queryset-refactor: Clarified what the default reverse names are for

ManyToManyFields and ForeignKeys on abstract base classes.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7452 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2008-04-24 11:21:49 +00:00
parent 9d6f0f9e10
commit 675815d6a1

View File

@ -2185,6 +2185,10 @@ whilst the reverse name of the ``ChildB.m2m`` field will be
construct your related name, but if you forget to use it, Django will raise construct your related name, but if you forget to use it, Django will raise
errors when you validate your models (or run ``syncdb``). errors when you validate your models (or run ``syncdb``).
If you don't specify a ``related_name`` attribute for a field in an abstract
base class, the default reverse name will be the name of the child class
followed by ``'_set'``, just as it normally would be if you'd declared the field directly on the child class. For example, in the above code, if the ``related_name`` attribute was omitted, the reverse name for the ``m2m`` field would be ``childa_set`` in the ``ChildA`` case and ``childb_set`` for the ``ChildB`` field.
Multi-table inheritance Multi-table inheritance
----------------------- -----------------------