Skip to content

Commit

Permalink
Expand MediaContainer docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
tbrlpld committed Dec 11, 2023
1 parent f0824c7 commit 5cc1c5c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
9 changes: 9 additions & 0 deletions laces/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion laces/tests/test_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 5cc1c5c

Please sign in to comment.