Actions¶
An Action may apply reversible modifications of a django Form.
It should always take a list of :py:cls:`~facond.conditions.Condition` as first argument, and then whatever it’s going to need to work.
Action¶
JavaScript¶
-
class
Action(conditions)¶ Apply a reversible action on the DOM if conditions apply, unapply otherwise.
Arguments: - conditions – List of :js:cls:`Condition` objects
-
Action.apply(form)¶ Modify the DOM, should save the state for
unapply().Arguments: - form –
Form()object to apply on.
- form –
Python¶
-
class
facond.actions.Action(conditions)[source]¶ An action to take on a list of fields.
The
execute()will first executevalidate()for every of its conditions against the :py:cls:`~facond.forms.Form` instance it is passed.
RemoveChoices¶
JavaScript¶
-
class
RemoveChoices(conditions, field, choices)¶ Remove given choices from a field.
Arguments: - conditions – List of
Condition()objects
- conditions – List of
RemoveField¶
JavaScript¶
-
class
RemoveField(conditions, field)¶ Remove a field from a form.
Arguments: - conditions – List of
Condition()objects
:param
Field(): Subject Field instance.- conditions – List of