djblets.forms.fieldsets¶
Utilities related to django.contrib.admin fieldsets.
- filter_fieldsets(form, admin=None, fieldsets=None, exclude=None, exclude_collapsed=True)[source]¶
Filter fieldsets.
This method allows us to filter fieldsets from a ModelAdmin to exclude fields (or an entire fieldset).
- Parameters
form (type or django.forms.Form) – The form (or form class) to retrieve fieldsets for.
admin (django.contrib.admin.ModelAdmin, optional) – The model admin to retrieve fieldsets from. If this argument is not provided,
fieldsets
will be used instead.fieldsets (tuple, optional) – The fieldsets to use.
exclude (list of unicode, optional) – An optional list of fields to exclude.
exclude_collapsed (bool, optional) – Whether or not to exclude fieldsets marked as collapsed by default.
- Yields
dict – An entry for each field set that should be rendered.
If a field set would have no rendered fields, it is not yielded.