diff --git a/django/contrib/admin/widgets.py b/django/contrib/admin/widgets.py
index f501ffb..6857579 100644
a
|
b
|
class RelatedFieldWidgetWrapper(forms.Widget):
|
235 | 235 | admin interface. |
236 | 236 | """ |
237 | 237 | def __init__(self, widget, rel, admin_site, can_add_related=None): |
238 | | self.is_hidden = widget.is_hidden |
239 | 238 | self.needs_multipart_form = widget.needs_multipart_form |
240 | 239 | self.attrs = widget.attrs |
241 | 240 | self.choices = widget.choices |
… |
… |
class RelatedFieldWidgetWrapper(forms.Widget):
|
257 | 256 | return obj |
258 | 257 | |
259 | 258 | @property |
| 259 | def is_hidden(self): |
| 260 | return self.widget.is_hidden |
| 261 | |
| 262 | @property |
260 | 263 | def media(self): |
261 | 264 | return self.widget.media |
262 | 265 | |
diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index aeb674d..0d78d91 100644
a
|
b
|
class SubWidget(object):
|
166 | 166 | |
167 | 167 | |
168 | 168 | class Widget(six.with_metaclass(MediaDefiningClass)): |
169 | | is_hidden = False # Determines whether this corresponds to an <input type="hidden">. |
170 | 169 | needs_multipart_form = False # Determines does this widget need multipart form |
171 | 170 | is_localized = False |
172 | 171 | is_required = False |
… |
… |
class Widget(six.with_metaclass(MediaDefiningClass)):
|
183 | 182 | memo[id(self)] = obj |
184 | 183 | return obj |
185 | 184 | |
| 185 | @property |
| 186 | def is_hidden(self): |
| 187 | return self.input_type == 'hidden' if hasattr(self, 'input_type') else False |
| 188 | |
186 | 189 | def subwidgets(self, name, value, attrs=None, choices=()): |
187 | 190 | """ |
188 | 191 | Yields all "subwidgets" of this widget. Used only by RadioSelect to |
… |
… |
class PasswordInput(TextInput):
|
286 | 289 | |
287 | 290 | class HiddenInput(Input): |
288 | 291 | input_type = 'hidden' |
289 | | is_hidden = True |
290 | 292 | |
291 | 293 | |
292 | 294 | class MultipleHiddenInput(HiddenInput): |
… |
… |
class MultiWidget(Widget):
|
778 | 780 | self.widgets = [w() if isinstance(w, type) else w for w in widgets] |
779 | 781 | super(MultiWidget, self).__init__(attrs) |
780 | 782 | |
| 783 | @property |
| 784 | def is_hidden(self): |
| 785 | return all(w.is_hidden for w in self.widgets) |
| 786 | |
781 | 787 | def render(self, name, value, attrs=None): |
782 | 788 | if self.is_localized: |
783 | 789 | for widget in self.widgets: |
… |
… |
class SplitHiddenDateTimeWidget(SplitDateTimeWidget):
|
865 | 871 | """ |
866 | 872 | A Widget that splits datetime input into two <input type="hidden"> inputs. |
867 | 873 | """ |
868 | | is_hidden = True |
869 | | |
870 | 874 | def __init__(self, attrs=None, date_format=None, time_format=None): |
871 | 875 | super(SplitHiddenDateTimeWidget, self).__init__(attrs, date_format, time_format) |
872 | 876 | for widget in self.widgets: |
873 | 877 | widget.input_type = 'hidden' |
874 | | widget.is_hidden = True |