git://git.onelab.eu
/
plstackapi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f17fc26
)
PlainTextWidget no longer wipes out the form field value
author
Tony Mack
<tmack@paris.CS.Princeton.EDU>
Sat, 4 May 2013 03:30:41 +0000
(23:30 -0400)
committer
Tony Mack
<tmack@paris.CS.Princeton.EDU>
Sat, 4 May 2013 03:30:41 +0000
(23:30 -0400)
plstackapi/core/admin.py
patch
|
blob
|
history
diff --git
a/plstackapi/core/admin.py
b/plstackapi/core/admin.py
index
86b48a2
..
1f0744a
100644
(file)
--- a/
plstackapi/core/admin.py
+++ b/
plstackapi/core/admin.py
@@
-53,9
+53,13
@@
class NodeInline(admin.TabularInline):
model = Node
extra = 0
-class PlainTextWidget(forms.Widget):
- def render(self, _name, value, attrs):
- return mark_safe(value) if value is not None else ''
+class PlainTextWidget(forms.HiddenInput):
+ input_type = 'hidden'
+
+ def render(self, name, value, attrs=None):
+ if value is None:
+ value = ''
+ return mark_safe(value + super(PlainTextWidget, self).render(name, value, attrs))
class PlanetStackBaseAdmin(admin.ModelAdmin):
save_on_top = False