Simplified Widget.get_context() a bit.
This commit is contained in:
parent
83c631ade7
commit
b2ef3d7157
|
@ -225,16 +225,16 @@ class Widget(metaclass=MediaDefiningClass):
|
|||
return str(value)
|
||||
|
||||
def get_context(self, name, value, attrs):
|
||||
context = {}
|
||||
context['widget'] = {
|
||||
'name': name,
|
||||
'is_hidden': self.is_hidden,
|
||||
'required': self.is_required,
|
||||
'value': self.format_value(value),
|
||||
'attrs': self.build_attrs(self.attrs, attrs),
|
||||
'template_name': self.template_name,
|
||||
return {
|
||||
'widget': {
|
||||
'name': name,
|
||||
'is_hidden': self.is_hidden,
|
||||
'required': self.is_required,
|
||||
'value': self.format_value(value),
|
||||
'attrs': self.build_attrs(self.attrs, attrs),
|
||||
'template_name': self.template_name,
|
||||
},
|
||||
}
|
||||
return context
|
||||
|
||||
def render(self, name, value, attrs=None, renderer=None):
|
||||
"""Render the widget as an HTML string."""
|
||||
|
|
Loading…
Reference in New Issue