summaryrefslogtreecommitdiff
path: root/pgweb/util/helpers.py
diff options
context:
space:
mode:
authorMagnus Hagander2013-01-30 13:01:25 +0000
committerMagnus Hagander2013-01-30 13:01:25 +0000
commit3818de50c509f13f6679d646d290dc5c88635e2e (patch)
tree08d66ae29bd03a0b96930700be036470d4d5016e /pgweb/util/helpers.py
parent1917a5cf72b6bca00b2e8509ae7ceff2d951d9ad (diff)
Add ability to toggle fields in forms
This uses jQuery to make it possible to enable and disable fields in the default forms, by specifying an attribute on the form class. The form class still has to implement proper validators, so it does not rely on client side validations.
Diffstat (limited to 'pgweb/util/helpers.py')
-rw-r--r--pgweb/util/helpers.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/pgweb/util/helpers.py b/pgweb/util/helpers.py
index 831cb058..817f416e 100644
--- a/pgweb/util/helpers.py
+++ b/pgweb/util/helpers.py
@@ -57,6 +57,7 @@ def simple_form(instancetype, itemid, request, formclass, formtemplate='base/for
'formitemtype': instance._meta.verbose_name,
'markdownfields': markdownfields,
'form_intro': hasattr(form, 'form_intro') and form.form_intro or None,
+ 'toggle_fields': hasattr(form, 'toggle_fields') and form.toggle_fields or None,
'savebutton': (itemid == "new") and "New" or "Save",
'operation': (itemid == "new") and "New" or "Edit",
}, NavContext(request, navsection))