Refs #27919 -- Changed contrib widget's get_context() attrs kwarg to an arg.

Follow up to 075e93c16a.
This commit is contained in:
Tim Graham 2017-03-21 10:15:34 -04:00
parent 1e93210f1f
commit 93d0770104
3 changed files with 6 additions and 6 deletions

View File

@ -31,7 +31,7 @@ class FilteredSelectMultiple(forms.SelectMultiple):
self.is_stacked = is_stacked
super().__init__(attrs, choices)
def get_context(self, name, value, attrs=None):
def get_context(self, name, value, attrs):
context = super().get_context(name, value, attrs)
context['widget']['attrs']['class'] = 'selectfilter'
if self.is_stacked:
@ -129,7 +129,7 @@ class ForeignKeyRawIdWidget(forms.TextInput):
self.db = using
super().__init__(attrs)
def get_context(self, name, value, attrs=None):
def get_context(self, name, value, attrs):
context = super().get_context(name, value, attrs)
rel_to = self.rel.model
if rel_to in self.admin_site._registry:
@ -196,7 +196,7 @@ class ManyToManyRawIdWidget(ForeignKeyRawIdWidget):
"""
template_name = 'admin/widgets/many_to_many_raw_id.html'
def get_context(self, name, value, attrs=None):
def get_context(self, name, value, attrs):
context = super().get_context(name, value, attrs)
if self.rel.model in self.admin_site._registry:
# The related object is registered with the same AdminSite
@ -265,7 +265,7 @@ class RelatedFieldWidgetWrapper(forms.Widget):
return reverse("admin:%s_%s_%s" % (info + (action,)),
current_app=self.admin_site.name, args=args)
def get_context(self, name, value, attrs=None):
def get_context(self, name, value, attrs):
from django.contrib.admin.views.main import IS_POPUP_VAR, TO_FIELD_VAR
rel_opts = self.rel.model._meta
info = (rel_opts.app_label, rel_opts.model_name)

View File

@ -15,7 +15,7 @@ class OpenLayersWidget(Textarea):
"""
Render an OpenLayers map using the WKT of the geometry.
"""
def get_context(self, name, value, attrs=None):
def get_context(self, name, value, attrs):
# Update the template parameters with any attributes passed in.
if attrs:
self.params.update(attrs)

View File

@ -40,7 +40,7 @@ class BaseGeometryWidget(Widget):
logger.error("Error creating geometry from value '%s' (%s)", value, err)
return None
def get_context(self, name, value, attrs=None):
def get_context(self, name, value, attrs):
# If a string reaches here (via a validation error on another
# field) then just reconstruct the Geometry.
if value and isinstance(value, str):