Add support for standard Django fieldsets for forms.

Review Request #7945 — Created Feb. 5, 2016 and submitted

Information

Djblets
release-0.10.x

Reviewers

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.

Description From Last Updated

Typo: Normalizea

daviddavid

How about: try: fieldsets = form.Meta.fieldsets except AttributeError: fieldsets = []

daviddavid
reviewbot
  1. 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
    
    
  2. 
      
david
  1. 
      
  2. Show all issues

    Typo: Normalizea

  3. djblets/util/templatetags/djblets_forms.py (Diff revision 1)
     
     
     
     
     
     
     
    Show all issues

    How about:

    try:
        fieldsets = form.Meta.fieldsets
    except AttributeError:
        fieldsets = []
    
  4. 
      
chipx86
reviewbot
  1. 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
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-0.10.x (e324c16)
Loading...