Fixed #23822 -- Added support for serializing model managers in migration

Thanks to Shai Berger, Loïc Bistuer, Simon Charette, Andrew Godwin,
Tim Graham, Carl Meyer, and others for their review and input.
This commit is contained in:
Markus Holtermann 2014-12-12 23:19:58 +01:00 committed by Tim Graham
parent e37ab311fc
commit aa5ef0d4fc
28 changed files with 608 additions and 48 deletions

View file

@ -67,7 +67,9 @@ class QuerySet(object):
def as_manager(cls):
# Address the circular dependency between `Queryset` and `Manager`.
from django.db.models.manager import Manager
return Manager.from_queryset(cls)()
manager = Manager.from_queryset(cls)()
manager._built_as_manager = True
return manager
as_manager.queryset_only = True
as_manager = classmethod(as_manager)