Opened 6 years ago

Closed 6 years ago

#14407 closed (fixed)

ManyToManyRawIdWidget.value_from_datadict is inexplicably complicated and can be simplified

Reported by: tyrion Owned by: nobody
Component: contrib.admin Version: 1.2
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation:
Needs tests: Patch needs improvement:
Easy pickings: UI/UX:


ManyToManyRawIdWidget.value_from_datadict can be simplified from:

    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


    def value_from_datadict(self, data, files, name):
        value = data.get(name)
        if value:
            return value.split(',')

Attachments (1)

patch.diff (616 bytes) - added by tyrion 6 years ago.
I've not tested it

Download all attachments as: .zip

Change History (2)

Changed 6 years ago by tyrion

I've not tested it

comment:1 Changed 6 years ago by Honza_Kral

  • Resolution set to fixed
  • Status changed from new to closed

(In [14283]) Fixed #14407 -- Simplified ManyToManyRawIdWidget.value_from_datadict, Thanks tyrion!

Note: See TracTickets for help on using tickets.
Back to Top