Code

Ticket #11303: hidden_input.diff

File hidden_input.diff, 527 bytes (added by oduvan, 5 years ago)
Line 
1Index: django/forms/widgets.py
2===================================================================
3--- django/forms/widgets.py     (revision 10980)
4+++ django/forms/widgets.py     (working copy)
5@@ -233,6 +233,10 @@
6 class HiddenInput(Input):
7     input_type = 'hidden'
8     is_hidden = True
9+    def render(self, name, value, attrs=None):
10+        if isinstance(value,bool):
11+            value = value and 'on' or ''
12+        return super(HiddenInput,self).render(name,value,attrs)
13 
14 class MultipleHiddenInput(HiddenInput):
15     """