From 585f10754ce92c91b8c1249d8a8fa943239130e2 Mon Sep 17 00:00:00 2001 From: Jared Lewis Date: Tue, 19 Jan 2016 16:52:52 -0500 Subject: [PATCH 1/2] * Revert changes --- dynamic_initial_data/base.py | 18 +++++------------- dynamic_initial_data/version.py | 2 +- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/dynamic_initial_data/base.py b/dynamic_initial_data/base.py index d98016e..842fd2b 100644 --- a/dynamic_initial_data/base.py +++ b/dynamic_initial_data/base.py @@ -1,3 +1,5 @@ +from datetime import datetime + from django.apps import apps from django.contrib.contenttypes.models import ContentType from django.db.transaction import atomic @@ -95,7 +97,7 @@ def load_app(self, app): return self.loaded_apps[app] @atomic - def update_app(self, app, handle_deletions=True): + def update_app(self, app): """ Loads and runs `update_initial_data` of the specified app. Any dependencies contained within the initial data class will be run recursively. Dependency cycles are checked for and a cache is built @@ -122,7 +124,7 @@ def update_app(self, app, handle_deletions=True): # update initial data of dependencies for dependency in dependencies: - self.update_app(dependency, handle_deletions=False) + self.update_app(dependency) self.log('Updating app {0}'.format(app)) @@ -139,11 +141,6 @@ def update_app(self, app, handle_deletions=True): # keep track that this app has been updated self.updated_apps.add(app) - # Handle deletions if necessary, this could be a single call that was nat batched with multiple updates - # We cannot handle this case yet since we do not know what app registered what deletions - # if handle_deletions: - # self.handle_deletions() - def handle_deletions(self): """ Manages handling deletions of objects that were previously managed by the initial data process but no longer @@ -190,13 +187,8 @@ def update_all_apps(self): Loops through all app names contained in settings.INSTALLED_APPS and calls `update_app` on each one. Handles any object deletions that happened after all apps have been initialized. """ - - # Loop over all the apps and update each one, buffering the deletions until the end for app in apps.get_app_configs(): - self.update_app( - app=app.name, - handle_deletions=False - ) + self.update_app(app.name) # During update_app, all apps added model objects that were registered for deletion. # Delete all objects that were previously managed by the initial data process diff --git a/dynamic_initial_data/version.py b/dynamic_initial_data/version.py index ed7d50e..93b60a1 100644 --- a/dynamic_initial_data/version.py +++ b/dynamic_initial_data/version.py @@ -1 +1 @@ -__version__ = '0.5.3' +__version__ = '0.5.1' From ef7b6b6b86cfca8f8a6e4fcf21a69b1650a181eb Mon Sep 17 00:00:00 2001 From: Jared Lewis Date: Tue, 19 Jan 2016 16:56:15 -0500 Subject: [PATCH 2/2] * Flake8 --- dynamic_initial_data/base.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/dynamic_initial_data/base.py b/dynamic_initial_data/base.py index 842fd2b..c5e6837 100644 --- a/dynamic_initial_data/base.py +++ b/dynamic_initial_data/base.py @@ -1,5 +1,3 @@ -from datetime import datetime - from django.apps import apps from django.contrib.contenttypes.models import ContentType from django.db.transaction import atomic