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.
This commit is contained in:
Magnus Hagander
2013-01-30 14:01:25 +01:00
parent 1917a5cf72
commit 3818de50c5
2 changed files with 28 additions and 0 deletions

View File

@ -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))