0
0
mirror of https://github.com/django/django.git synced 2024-12-01 15:42:04 +01:00

Condensed some widgets code.

This commit is contained in:
Daniel Hahler 2018-03-03 19:35:09 +01:00 committed by Tim Graham
parent 3d8fadad0f
commit 683341db43
2 changed files with 4 additions and 12 deletions

View File

@ -389,10 +389,7 @@ class AutocompleteMixin:
self.admin_site = admin_site
self.db = using
self.choices = choices
if attrs is not None:
self.attrs = attrs.copy()
else:
self.attrs = {}
self.attrs = {} if attrs is None else attrs.copy()
def get_url(self):
model = self.rel.model

View File

@ -161,10 +161,8 @@ def media_property(cls):
for medium in extend:
m = m + base[medium]
return m + Media(definition)
else:
return Media(definition)
else:
return base
return Media(definition)
return base
return property(_media)
@ -188,10 +186,7 @@ class Widget(metaclass=MediaDefiningClass):
supports_microseconds = True
def __init__(self, attrs=None):
if attrs is not None:
self.attrs = attrs.copy()
else:
self.attrs = {}
self.attrs = {} if attrs is None else attrs.copy()
def __deepcopy__(self, memo):
obj = copy.copy(self)