mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Refs #26230 -- Removed support for model name query lookups when using Meta.default_related_name.
Per deprecation timeline.
This commit is contained in:
parent
2d7fb77987
commit
bfe0d54514
4 changed files with 7 additions and 50 deletions
|
@ -130,30 +130,6 @@ Django quotes column and table names behind the scenes.
|
|||
and the name of the model, both lowercased. See the paragraph on
|
||||
:ref:`related names for abstract models <abstract-related-name>`.
|
||||
|
||||
.. deprecated:: 1.10
|
||||
|
||||
This attribute now affects ``related_query_name``. The old query lookup
|
||||
name is deprecated::
|
||||
|
||||
from django.db import models
|
||||
|
||||
class Foo(models.Model):
|
||||
pass
|
||||
|
||||
class Bar(models.Model):
|
||||
foo = models.ForeignKey(Foo)
|
||||
|
||||
class Meta:
|
||||
default_related_name = 'bars'
|
||||
|
||||
::
|
||||
|
||||
>>> bar = Bar.objects.get(pk=1)
|
||||
>>> # Using model name "bar" as lookup string is deprecated.
|
||||
>>> Foo.objects.get(bar=bar)
|
||||
>>> # You should use default_related_name "bars".
|
||||
>>> Foo.objects.get(bars=bar)
|
||||
|
||||
``get_latest_by``
|
||||
-----------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue