diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2006-11-30 03:58:25 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2006-11-30 03:58:25 +0000 |
| commit | 4dca65cdfc1e206fac323bd8afae9ae1fccc9dac (patch) | |
| tree | 9441161d640dc859ae30e9b661d9afcf74e44a71 /django/newforms/forms.py | |
| parent | d506b90163feb4780d358c657804db446bc60780 (diff) | |
newforms: Added BoundField.as_hidden()
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4145 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/newforms/forms.py')
| -rw-r--r-- | django/newforms/forms.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/django/newforms/forms.py b/django/newforms/forms.py index 3712c676c4..393f576dca 100644 --- a/django/newforms/forms.py +++ b/django/newforms/forms.py @@ -5,7 +5,7 @@ Form classes from django.utils.datastructures import SortedDict from django.utils.html import escape from fields import Field -from widgets import TextInput, Textarea +from widgets import TextInput, Textarea, HiddenInput from util import ErrorDict, ErrorList, ValidationError NON_FIELD_ERRORS = '__all__' @@ -194,6 +194,12 @@ class BoundField(object): "Returns a string of HTML for representing this as a <textarea>." return self.as_widget(Textarea(), attrs) + def as_hidden(self, attrs=None): + """ + Returns a string of HTML for representing this as an <input type="hidden">. + """ + return self.as_widget(HiddenInput(), attrs) + def _data(self): "Returns the data for this BoundField, or None if it wasn't given." return self._form.data.get(self._name, None) |
