Dynamic forms for Django
This app provides features a form class dynamic, both on the client and server side. For example if you want a field to be remove if another field has a particular value or to filter choices based on a set conditions. The demo is automatically updated when a commit is tested on master.
Pypy, Python 2.7, 3.4, Django 1.8+ are supported.
For example, if your form should allow support only if linux is selected:
from ddf import shortcuts as ddf class TestForm(ddf.FormMixin, forms.Form): platform = forms.ChoiceField(choices=( ('Linux', 'Linux'), ('Windows', 'Windows'), )) service = forms.ChoiceField(choices=( ('Format', 'Format'), ('Support', 'Support') )) # Remove the 'Support' choice from the 'service' field if 'platform' # value is 'Windows': _ddf = dict( service=[ ddf.RemoveChoices( ['Support'], ddf.ValueIs('platform', 'Windows'), ) ] )
In this example, we create a configuration field and add the RemoveChoices action to the service field, with the condition that the platform field value is Windows.
A configuration is structured as such: for each field, you may add a list of actions, for each action a list of conditions. When the user changes a field, each action’s conditions are evaluated and if they all pass then the action is applied, otherwise it is unapplied. Possibilities are huge here.
It is released with the Creative Commons Attribution-NonCommercial 3.0 Unported License, but a commercial license is available, please get in touch my username @ yourlabs.org if you are interrested.
Note that the money goes to YourLabs, a non-profit foundation to promote the role of hackers in the process of making our society more fair and free, while using their skills to develop local economy and give internet back to the people.
The project is pretty young, but the basic building blocks are there. We should be able to add actions and conditions easily.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size ddf-0.0.0.tar.gz (5.3 kB)||File type Source||Python version None||Upload date||Hashes View|