#33669: Bug in contrib/admin/templatetags/admin_modify.py
-------------------------------------------+------------------------
               Reporter:  rezazeiny        |          Owner:  (none)
                   Type:  Bug              |         Status:  new
              Component:  Error reporting  |        Version:  4.0
               Severity:  Normal           |       Keywords:
           Triage Stage:  Unreviewed       |      Has patch:  0
    Needs documentation:  0                |    Needs tests:  0
Patch needs improvement:  0                |  Easy pickings:  0
                  UI/UX:  0                |
-------------------------------------------+------------------------
 I have a bug in function cell_count in file
 django/contrib/admin/templatetags/admin_modify.py

 please check type of field_data if this is dictionary this can not call
 with dot.

 I fixed it and over write in my code. my code is:
 {{{

 @register.filter
 def cell_count(inline_admin_form):
     """Return the number of cells used in a tabular inline."""
     count = 1  # Hidden cell with hidden 'id' field
     for fieldset in inline_admin_form:
         # Count all visible fields.
         for line in fieldset:
             for field in line:
                 field_data = field.field
                 if type(field_data) == dict:
                     is_hidden = field_data["is_hidden"]
                 else:
                     is_hidden = field_data.is_hidden
                 if not is_hidden:
                     count += 1
     if inline_admin_form.formset.can_delete:
         # Delete checkbox
         count += 1
     return count
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33669>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070180707a2524-32c5b72f-2e61-4a54-b78c-b9256d081045-000000%40eu-central-1.amazonses.com.

Reply via email to