1 2 3 4 5 6 7 8 9 10 11 | def new_callback(exclude=None, include=None):
"""
Create a form callback which excludes or only includes certain fields.
"""
def _callback(field, **kwargs):
if include and field.name not in include:
return None
if exclude and field.name in exclude:
return None
return field.formfield(**kwargs)
return _callback
|
More like this
- Javascript Chain Select Widget by ogo 3 years, 11 months ago
- Automatically trim newforms text fields by miracle2k 4 years, 8 months ago
- Natural language date/time form fields by jdriscoll 4 years, 11 months ago
- newforms and ModelForm by danfairs 4 years, 4 months ago
- ModelForm-based create_update generic views by carljm 3 years, 10 months ago
Comments