Kaydet (Commit) 683341db authored tarafından Daniel Hahler's avatar Daniel Hahler Kaydeden (comit) Tim Graham

Condensed some widgets code.

üst 3d8fadad
...@@ -389,10 +389,7 @@ class AutocompleteMixin: ...@@ -389,10 +389,7 @@ class AutocompleteMixin:
self.admin_site = admin_site self.admin_site = admin_site
self.db = using self.db = using
self.choices = choices self.choices = choices
if attrs is not None: self.attrs = {} if attrs is None else attrs.copy()
self.attrs = attrs.copy()
else:
self.attrs = {}
def get_url(self): def get_url(self):
model = self.rel.model model = self.rel.model
......
...@@ -161,10 +161,8 @@ def media_property(cls): ...@@ -161,10 +161,8 @@ def media_property(cls):
for medium in extend: for medium in extend:
m = m + base[medium] m = m + base[medium]
return m + Media(definition) return m + Media(definition)
else: return Media(definition)
return Media(definition) return base
else:
return base
return property(_media) return property(_media)
...@@ -188,10 +186,7 @@ class Widget(metaclass=MediaDefiningClass): ...@@ -188,10 +186,7 @@ class Widget(metaclass=MediaDefiningClass):
supports_microseconds = True supports_microseconds = True
def __init__(self, attrs=None): def __init__(self, attrs=None):
if attrs is not None: self.attrs = {} if attrs is None else attrs.copy()
self.attrs = attrs.copy()
else:
self.attrs = {}
def __deepcopy__(self, memo): def __deepcopy__(self, memo):
obj = copy.copy(self) obj = copy.copy(self)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment