Tweak NestedObjects (and tests) comments.

This commit is contained in:
Ben Tappin 2013-05-29 14:10:56 +01:00
parent f4f400734c
commit 06302a7ed6
2 changed files with 11 additions and 4 deletions

View file

@ -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]}

View file

@ -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)