Opened 15 years ago
Closed 15 years ago
#14407 closed (fixed)
ManyToManyRawIdWidget.value_from_datadict is inexplicably complicated and can be simplified
| Reported by: | Germano Gabbianelli | Owned by: | nobody |
|---|---|---|---|
| Component: | contrib.admin | Version: | 1.2 |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
ManyToManyRawIdWidget.value_from_datadict can be simplified from:
!#python
def value_from_datadict(self, data, files, name):
value = data.get(name, None)
if value and ',' in value:
return data[name].split(',')
if value:
return [value]
return None
to:
def value_from_datadict(self, data, files, name): value = data.get(name) if value: return value.split(',')
Attachments (1)
Change History (2)
by , 15 years ago
| Attachment: | patch.diff added |
|---|
comment:1 by , 15 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
I've not tested it