diff --git a/djadmin2/utils.py b/djadmin2/utils.py index f597882..e7df77c 100644 --- a/djadmin2/utils.py +++ b/djadmin2/utils.py @@ -40,9 +40,13 @@ def model_app_label(obj): return model_options(obj).app_label -# Taken from the Django core. -# https://github.com/django/django/blob/1.5.1/django/contrib/admin/util.py#L144 class NestedObjects(Collector): + """ + This is adopted from the Django core. django-admin2 mandates that code + doesn't depend on imports from django.contrib.admin. + + https://github.com/django/django/blob/1.5.1/django/contrib/admin/util.py#L144 + """ def __init__(self, *args, **kwargs): super(NestedObjects, self).__init__(*args, **kwargs) self.edges = {} # {from_instance: [to_instances]} diff --git a/example/blog/tests/test_nestedobjects.py b/example/blog/tests/test_nestedobjects.py index c58378f..1501906 100644 --- a/example/blog/tests/test_nestedobjects.py +++ b/example/blog/tests/test_nestedobjects.py @@ -6,11 +6,14 @@ from djadmin2.utils import NestedObjects from ..models import Count, Event, EventGuide, Guest, Location -# Largely taken from the Django core. -# https://github.com/django/django/blob/1.5.1/tests/regressiontests/admin_util/tests.py class NestedObjectsTests(TestCase): """ Tests for ``NestedObject`` utility collection. + + This is adopted from the Django core. django-admin2 mandates that code + doesn't depend on imports from django.contrib.admin. + + https://github.com/django/django/blob/1.5.1/tests/regressiontests/admin_util/tests.py """ def setUp(self): self.n = NestedObjects(using=DEFAULT_DB_ALIAS)