Ticket #4321: hidden_widget.patch

File hidden_widget.patch, 961 bytes (added by SmileyChris, 8 years ago)
  • django/newforms/forms.py

     
    66from django.utils.html import escape
    77from django.utils.encoding import StrAndUnicode
    88from fields import Field
    9 from widgets import TextInput, Textarea, HiddenInput, MultipleHiddenInput
     9from widgets import Widget, TextInput, Textarea, HiddenInput, MultipleHiddenInput
    1010from util import flatatt, ErrorDict, ErrorList, ValidationError
    1111import copy
    1212
     
    273273        """
    274274        Returns a string of HTML for representing this as an <input type="hidden">.
    275275        """
    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)
    277280
    278281    def _data(self):
    279282        """
Back to Top