From 4f06422ac414da3edb1cb9507dfe008b1c0ce17b Mon Sep 17 00:00:00 2001 From: Federico Capoano Date: Fri, 5 Feb 2021 12:26:15 -0500 Subject: [PATCH] [fix] Load models using swappable --- owm_legacy/tests.py | 5 ++++- owm_legacy/views.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/owm_legacy/tests.py b/owm_legacy/tests.py index e0c798a..9930c9f 100644 --- a/owm_legacy/tests.py +++ b/owm_legacy/tests.py @@ -1,13 +1,16 @@ from time import sleep +import swapper from django.test import TestCase from django.urls import reverse -from openwisp_controller.config.models import Config, Device from openwisp_controller.config.tests import CreateConfigMixin from openwisp_users.tests.utils import TestOrganizationMixin from owm_legacy.settings import ALLOWED_SUBNETS +Device = swapper.load_model('config', 'Device') +Config = swapper.load_model('config', 'Config') + class TestOwmLegacy(CreateConfigMixin, TestOrganizationMixin, TestCase): """ diff --git a/owm_legacy/views.py b/owm_legacy/views.py index 06a445d..c2bfbc2 100644 --- a/owm_legacy/views.py +++ b/owm_legacy/views.py @@ -1,6 +1,6 @@ +import swapper from django.shortcuts import get_object_or_404 -from openwisp_controller.config.models import Config from openwisp_controller.config.utils import ( send_device_config, send_file, @@ -9,6 +9,9 @@ from .utils import forbid_unallowed +Device = swapper.load_model('config', 'Device') +Config = swapper.load_model('config', 'Config') + def get_config_md5(request, mac_address): """