Add support for standard Django fieldsets for forms.
Review Request #7945 — Created Feb. 5, 2016 and submitted
When we first built our siteconfig template, which has gone on to become the base for many of our configuration/form templates, we used a different version of the fieldset structure than Django did. This makes it a bit difficult for users who are coming from Django's form and trying to make it work with these forms. Our template now uses a new get_fieldsets filter, which normalizes the fieldset entries, allowing the use of either format. It gives us a good way to transition to Django's form over time.
Tested with existing configuration forms, and with newer forms containing
Django's style.Unit tests pass.
-
-
-
djblets/util/templatetags/djblets_forms.py (Diff revision 1) How about:
try: fieldsets = form.Meta.fieldsets except AttributeError: fieldsets = []
Change Summary:
- Fixed a typo in a docstring.
- Simplified the code accessing the Meta's fieldsets.
Diff: |
Revision 2 (+129 -14) |
---|
-
Tool: PEP8 Style Checker Processed Files: djblets/util/templatetags/tests.py djblets/util/templatetags/djblets_forms.py Ignored Files: djblets/forms/templates/djblets_forms/admin/change_form_page.html Tool: Pyflakes Processed Files: djblets/util/templatetags/tests.py djblets/util/templatetags/djblets_forms.py Ignored Files: djblets/forms/templates/djblets_forms/admin/change_form_page.html