From 7138f9388e871f25cda02d1f228dc0470f49b0b2 Mon Sep 17 00:00:00 2001 From: Manuel Francisco Naranjo Date: Tue, 28 Jul 2015 13:50:28 -0300 Subject: [PATCH] Fixing django.apps bug --- dbview/helpers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dbview/helpers.py b/dbview/helpers.py index 436c1b1..c5243d5 100644 --- a/dbview/helpers.py +++ b/dbview/helpers.py @@ -1,4 +1,5 @@ from django.db import migrations +from django.apps import apps class CreateView(migrations.CreateModel): def database_forwards(self, app_label, schema_editor, from_state, to_state): @@ -6,7 +7,8 @@ class CreateView(migrations.CreateModel): if not self.allow_migrate_model(schema_editor.connection.alias, model): raise - model = apps.get_app_config(app_label).models_module + models = apps.get_app_config(app_label).models_module + model = getattr(models, self.name) sql = 'DROP VIEW IF EXISTS %(table)s;'