Skip to content

Commit

Permalink
Fixed #15754 -- avoid recursively computing the tree of media widgets…
Browse files Browse the repository at this point in the history
… more times than is necessary for a wiget
  • Loading branch information
alex authored and Alex Gaynor committed Aug 6, 2012
1 parent ad237fb commit ede49c7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions django/forms/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,10 @@ def __add__(self, other):
def media_property(cls):
def _media(self):
# Get the media property of the superclass, if it exists
if hasattr(super(cls, self), 'media'):
base = super(cls, self).media
else:
sup_cls = super(cls, self)
try:
base = sup_cls.media
except AttributeError:
base = Media()

# Get the media definition for this class
Expand Down

0 comments on commit ede49c7

Please sign in to comment.