Opened 3 years ago
Closed 3 years ago
#33669 closed Bug (duplicate)
cell_count filter crashes if field_data is a dictionary
Reported by: | Reza Zeiny | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 4.0 |
Severity: | Normal | Keywords: | |
Cc: | rezazeiny1998@… | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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
Change History (2)
comment:1 by , 3 years ago
Component: | Error reporting → contrib.admin |
---|---|
Owner: | set to |
Summary: | Bug in contrib/admin/templatetags/admin_modify.py → cell_count filter crashes if field_data is a dictionary |
comment:2 by , 3 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
It's a duplicate of #33547, fixed by 445b075def2c037b971518963b70ce13df5e88a2 in Django 4.0.3.
Note:
See TracTickets
for help on using tickets.
What are the conditions to reproduce the issue?