openwisp / django-x509

Reusable django app implementing x509 PKI certificates management
http://openwisp.org
BSD 3-Clause "New" or "Revised" License
340 stars 69 forks source link

[bug] Loading model after registration in apps #63

Closed atb00ker closed 5 years ago

atb00ker commented 5 years ago

The #62 pull request broke openwisp-controller.

What caused the error?

In the tests/settings.py of django-x509 is in the INSTALLED_APPS which is not the case for openwisp-controller because the AbstractCa is registered with multitenancy features.

However, when the admin.site is trying to discover and register AbstractCa in openwisp-controller, it can't find django-x509 in installed apps hence throws an error:

RuntimeError: Model class django_x509.models.Ca doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

Solution:

The changes make sure admin.site doesn't need django_x509.models.Ca when trying to discover / register get_urls from Abstract_Ca.

Please correct my understanding should you find an error!

coveralls commented 5 years ago

Coverage Status

Coverage decreased (-0.01%) to 98.925% when pulling 90f6441101ee435fad222a8323f4f9f78b51d81e on namespace into 52dc22af4ee74755e26f47e874a63f7ad5ddbea4 on master.