Skip to content

Commit cc333d9

Browse files
committed
Changed method of retrieving an app's models. Also now importing import_module from importlib instead of from django.
- Legacy-Id: 12531
1 parent b3740bc commit cc333d9

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

ietf/api/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ def autodiscover():
133133
may want.
134134
"""
135135

136+
from importlib import import_module
136137
from django.conf import settings
137-
from django.utils.importlib import import_module
138138
from django.utils.module_loading import module_has_submodule
139139

140140
for app in settings.INSTALLED_APPS:

ietf/api/tests.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import os
22
import sys
33
import json
4+
from importlib import import_module
45

6+
from django.apps import apps
57
from django.test import Client
68
from django.conf import settings
7-
from django.utils.importlib import import_module
8-
from django.db import models
99

1010
from tastypie.exceptions import BadRequest
1111
from tastypie.test import ResourceTestCaseMixin
@@ -82,7 +82,8 @@ def test_all_model_resources_exist(self):
8282
self.assertValidJSONResponse(r)
8383
app_resources = json.loads(r.content)
8484
self._assertCallbackReturnsSameJSON("/api/v1/%s/"%name, app_resources)
85-
model_list = models.get_models(app.models)
85+
#
86+
model_list = apps.get_app_config(name).get_models()
8687
for model in model_list:
8788
if not model._meta.model_name in app_resources.keys():
8889
#print("There doesn't seem to be any resource for model %s.models.%s"%(app.__name__,model.__name__,))

0 commit comments

Comments
 (0)