diff options
| author | Marten Kenbeek <marten.knbk@gmail.com> | 2015-04-19 23:40:24 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-04-20 19:23:15 -0400 |
| commit | 516907540b81c009b74d29b2fa36319b47528b49 (patch) | |
| tree | c72b38e4724f934cfe092b73adb6670d912fce8e | |
| parent | 43f800a978deba4bc8d13e7f11e0afdc126cec25 (diff) | |
[1.8.x] Refs #24591 -- Optimized cloning of ModelState objects.
Changed ModelState.clone() to create a deepcopy of self.fields.
| -rw-r--r-- | django/db/migrations/state.py | 2 | ||||
| -rw-r--r-- | docs/releases/1.8.1.txt | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/django/db/migrations/state.py b/django/db/migrations/state.py index 9cf63a2cee..5754bd3a97 100644 --- a/django/db/migrations/state.py +++ b/django/db/migrations/state.py @@ -496,7 +496,7 @@ class ModelState(object): return self.__class__( app_label=self.app_label, name=self.name, - fields=list(self.construct_fields()), + fields=[(name, copy.deepcopy(field)) for name, field in self.fields], options=dict(self.options), bases=self.bases, managers=list(self.construct_managers()), diff --git a/docs/releases/1.8.1.txt b/docs/releases/1.8.1.txt index 7f9608d8b7..b226b0928c 100644 --- a/docs/releases/1.8.1.txt +++ b/docs/releases/1.8.1.txt @@ -4,7 +4,8 @@ Django 1.8.1 release notes *Under development* -Django 1.8.1 fixes several bugs in 1.8. +Django 1.8.1 fixes several bugs in 1.8 and includes some optimizations in the +migrations framework. Bugfixes ======== @@ -61,3 +62,11 @@ Bugfixes * Fixed JavaScript path of ``contrib.admin``’s related field widget when using alternate static file storages (:ticket:`24655`). + +Optimizations +============= + +* Changed ``ModelState`` to deepcopy fields instead of deconstructing and + reconstructing (:ticket:`24591`). This speeds up the rendering of model + states and reduces memory usage when running :djadmin:`manage.py migrate + <migrate>`. |
