From 621ff0aa1f0427ba1a8930a64b1eb09a9c4dbce5 Mon Sep 17 00:00:00 2001 From: Manuel Francisco Naranjo Date: Tue, 28 Jul 2015 08:33:42 -0300 Subject: [PATCH] Use django.apps features instead of __import__ --- dbview/helpers.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dbview/helpers.py b/dbview/helpers.py index 5aa362a..436c1b1 100644 --- a/dbview/helpers.py +++ b/dbview/helpers.py @@ -6,8 +6,7 @@ class CreateView(migrations.CreateModel): if not self.allow_migrate_model(schema_editor.connection.alias, model): raise - models = __import__(app_label).models - model = getattr(models, self.name) + model = apps.get_app_config(app_label).models_module sql = 'DROP VIEW IF EXISTS %(table)s;'