Opened 3 years ago

Closed 3 years ago

#33069 closed Uncategorized (invalid)

Comment to match code in django.form.widget.Widget.value_from_datadict

Reported by: Michael Owned by: nobody
Component: Uncategorized Version: 3.2
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

The comment says it returns None if not provided, maybe you are expecting a default dict to be passed in as data, in which case this ticket is invalid, but if it is a normal dict:

django/form/widget.py line 258 (class Widget):

    def value_from_datadict(self, data, files, name):
        """
        Given a dictionary of data and this widget's name, return the value
        of this widget or None if it's not provided.
        """
        return data.get(name)

then either the comment needs to trim or None if it's not provided or the code changed to data.get(name, None)

Change History (1)

comment:1 by Mariusz Felisiak, 3 years ago

Resolution: invalid
Status: newclosed

If works as documented with a dict, see dict.get() docs.

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