Ticket #4321: hidden_widget.patch
File hidden_widget.patch, 961 bytes (added by , 17 years ago) |
---|
-
django/newforms/forms.py
6 6 from django.utils.html import escape 7 7 from django.utils.encoding import StrAndUnicode 8 8 from fields import Field 9 from widgets import TextInput, Textarea, HiddenInput, MultipleHiddenInput9 from widgets import Widget, TextInput, Textarea, HiddenInput, MultipleHiddenInput 10 10 from util import flatatt, ErrorDict, ErrorList, ValidationError 11 11 import copy 12 12 … … 273 273 """ 274 274 Returns a string of HTML for representing this as an <input type="hidden">. 275 275 """ 276 return self.as_widget(self.field.hidden_widget(), attrs) 276 widget = self.field.hidden_widget 277 if not isinstance(widget, Widget): 278 widget = widget() 279 return self.as_widget(widget, attrs) 277 280 278 281 def _data(self): 279 282 """