diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index 4bbe6ce052..f306abdec6 100644
--- a/django/forms/widgets.py
+++ b/django/forms/widgets.py
@@ -52,6 +52,9 @@ class Media:
self._css = css
self._js = js
+ def __repr__(self):
+ return 'Media(css=%r, js=%r)' % (self._css, self._js)
+
def __str__(self):
return self.render()
diff --git a/tests/forms_tests/tests/test_media.py b/tests/forms_tests/tests/test_media.py
index dd10c60d2a..2b73a041be 100644
--- a/tests/forms_tests/tests/test_media.py
+++ b/tests/forms_tests/tests/test_media.py
@@ -25,6 +25,11 @@ class FormsMediaTestCase(SimpleTestCase):
"""
)
+ self.assertEqual(
+ repr(m),
+ "Media(css={'all': ('path/to/css1', '/path/to/css2')}, "
+ "js=('/path/to/js1', 'http://media.other.com/path/to/js2', 'https://secure.other.com/path/to/js3'))"
+ )
class Foo:
css = {