Opened 13 years ago
Closed 12 years ago
#18051 closed Cleanup/optimization (fixed)
flatten_fieldsets error
Reported by: | Riccardo Di Virgilio | Owned by: | mateusgondim |
---|---|---|---|
Component: | contrib.admin | Version: | 1.4 |
Severity: | Normal | Keywords: | |
Cc: | nick.sandford@… | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
hi when flattening fieldsets django checks if a fieldset has a line
if type(field) == tuple:
i've got a lot of errors because i often generate fieldsets from code, and sometime i must use list to declare lines.
maybe to avoid list problems it's better to change this line of code to
if type(field) in (tuple, list):
Attachments (2)
Change History (8)
comment:1 by , 13 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Type: | Uncategorized → Cleanup/optimization |
comment:2 by , 13 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
by , 13 years ago
Attachment: | ticket18051.diff added |
---|
I followed the above suggestion and replaced that line with the isinstance checking for list and tuples
comment:3 by , 13 years ago
Has patch: | set |
---|
comment:4 by , 13 years ago
Easy pickings: | set |
---|---|
Needs tests: | set |
The patch looks good. Could you add some tests for it? Thanks!
comment:5 by , 12 years ago
Cc: | added |
---|---|
Needs tests: | unset |
Triage Stage: | Accepted → Ready for checkin |
Patch with tests looks good.
comment:6 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
It seems that the pattern
isinstance(field, (list, tuple))
is widely used in Django.