mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
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:
committed by
Tim Graham
parent
e37ab311fc
commit
aa5ef0d4fc
@@ -37,7 +37,7 @@ Schema Operations
|
||||
CreateModel
|
||||
-----------
|
||||
|
||||
.. class:: CreateModel(name, fields, options=None, bases=None)
|
||||
.. class:: CreateModel(name, fields, options=None, bases=None, managers=None)
|
||||
|
||||
Creates a new model in the project history and a corresponding table in the
|
||||
database to match it.
|
||||
@@ -56,6 +56,14 @@ it can contain both class objects as well as strings in the format
|
||||
from the historical version). If it's not supplied, it defaults to just
|
||||
inheriting from the standard ``models.Model``.
|
||||
|
||||
``managers`` takes a list of 2-tuples of ``(manager_name, manager_instance)``.
|
||||
The first manager in the list will be the default manager for this model during
|
||||
migrations.
|
||||
|
||||
.. versionchanged:: 1.8
|
||||
|
||||
The ``managers`` argument was added.
|
||||
|
||||
DeleteModel
|
||||
-----------
|
||||
|
||||
@@ -121,6 +129,15 @@ like ``permissions`` and ``verbose_name``. Does not affect the database, but
|
||||
persists these changes for :class:`RunPython` instances to use. ``options``
|
||||
should be a dictionary mapping option names to values.
|
||||
|
||||
AlterModelManagers
|
||||
------------------
|
||||
|
||||
.. versionadded:: 1.8
|
||||
|
||||
.. class:: AlterModelManagers(name, managers)
|
||||
|
||||
Alters the managers that are available during migrations.
|
||||
|
||||
AddField
|
||||
--------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user