From 5cc1c5ce20222b7bfa0055a6dc938694fe065996 Mon Sep 17 00:00:00 2001 From: Tibor Leupold Date: Sun, 10 Dec 2023 20:19:12 -0800 Subject: [PATCH] Expand `MediaContainer` docstring --- laces/components.py | 9 +++++++++ laces/tests/test_components.py | 13 ++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/laces/components.py b/laces/components.py index 1b313a4..b55ffe3 100644 --- a/laces/components.py +++ b/laces/components.py @@ -52,6 +52,15 @@ class MediaContainer(list): Extracted from Wagtail. See: https://github.com/wagtail/wagtail/blob/ca8a87077b82e20397e5a5b80154d923995e6ca9/wagtail/admin/ui/components.py#L25-L36 # noqa: E501 + + The `MediaContainer` functionality depends on the `django.forms.widgets.Media` + class. The `Media` class provides the logic to combine the media definitions of + multiple objects through its `__add__` method. The `MediaContainer` relies on this + functionality to provide a `media` property that combines the media definitions of + its members. + + See also: + https://docs.djangoproject.com/en/4.2/topics/forms/media """ @property diff --git a/laces/tests/test_components.py b/laces/tests/test_components.py index b68c878..09cd89c 100644 --- a/laces/tests/test_components.py +++ b/laces/tests/test_components.py @@ -149,7 +149,18 @@ def tearDown(self): class TestMediaContainer(SimpleTestCase): - """Test the MediaContainer class.""" + """ + Test the MediaContainer class. + + The `MediaContainer` functionality depends on the `django.forms.widgets.Media` + class. The `Media` class provides the logic to combine the media definitions of + multiple objects through its `__add__` method. The `MediaContainer` relies on this + functionality to provide a `media` property that combines the media definitions of + its members. + + See also: + https://docs.djangoproject.com/en/4.2/topics/forms/media + """ def setUp(self): self.media_container = MediaContainer()