diff options
author | Loïc Bistuer <loic.bistuer@gmail.com> | 2016-04-17 18:55:55 +0700 |
---|---|---|
committer | Loïc Bistuer <loic.bistuer@gmail.com> | 2016-05-17 12:07:22 +0700 |
commit | ed0ff913c648b16c4471fc9a9441d1ee48cb5420 (patch) | |
tree | bf9cd3fad9f4c9abbec1967817842fdacad0938a /tests/proxy_models | |
parent | 3a47d42fa33012b2156bf04058d933df6b3082d2 (diff) | |
download | django-ed0ff913c648b16c4471fc9a9441d1ee48cb5420.tar.gz |
Fixed #10506, #13793, #14891, #25201 -- Introduced new APIs to specify models' default and base managers.
This deprecates use_for_related_fields.
Old API:
class CustomManager(models.Model):
use_for_related_fields = True
class Model(models.Model):
custom_manager = CustomManager()
New API:
class Model(models.Model):
custom_manager = CustomManager()
class Meta:
base_manager_name = 'custom_manager'
Refs #20932, #25897.
Thanks Carl Meyer for the guidance throughout this work.
Thanks Tim Graham for writing the docs.
Diffstat (limited to 'tests/proxy_models')
-rw-r--r-- | tests/proxy_models/models.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/proxy_models/models.py b/tests/proxy_models/models.py index cb3975d4ac..6960042d78 100644 --- a/tests/proxy_models/models.py +++ b/tests/proxy_models/models.py @@ -85,6 +85,8 @@ class StatusPerson(MyPerson): """ status = models.CharField(max_length=80) + objects = models.Manager() + # We can even have proxies of proxies (and subclass of those). @@ -96,6 +98,8 @@ class MyPersonProxy(MyPerson): class LowerStatusPerson(MyPersonProxy): status = models.CharField(max_length=80) + objects = models.Manager() + @python_2_unicode_compatible class User(models.Model): |