1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Refs #20203 -- Added tests to check inherited custom default manager

This commit is contained in:
Andriy Sokolovskiy
2015-06-18 17:13:04 +03:00
committed by Tim Graham
parent 7866968eb3
commit c31bf8cb54
2 changed files with 25 additions and 2 deletions

View File

@@ -6,8 +6,8 @@ from django.utils import six
from .models import (
Book, Car, CustomManager, CustomQuerySet, DeconstructibleCustomManager,
FunPerson, OneToOneRestrictedModel, Person, PersonManager,
PublishedBookManager, RelatedModel, RestrictedModel,
FunPerson, OneToOneRestrictedModel, Person, PersonFromAbstract,
PersonManager, PublishedBookManager, RelatedModel, RestrictedModel,
)
@@ -512,6 +512,17 @@ class CustomManagerTests(TestCase):
with self.assertRaisesMessage(ValueError, msg):
mgr.deconstruct()
def test_abstract_model_with_custom_manager_name(self):
"""
A custom manager may be defined on an abstract model.
It will be inherited by the abstract model's children.
"""
PersonFromAbstract.abstract_persons.create(objects='Test')
self.assertQuerysetEqual(
PersonFromAbstract.abstract_persons.all(), ["Test"],
lambda c: c.objects,
)
class TestCars(TestCase):