MCPcopy Create free account
hub / github.com/django/django / value_from_datadict

Method value_from_datadict

django/forms/widgets.py:604–618  ·  view source on GitHub ↗
(self, data, files, name)

Source from the content-addressed store, hash-verified

602 return context
603
604 def value_from_datadict(self, data, files, name):
605 upload = super().value_from_datadict(data, files, name)
606 self.checked = self.clear_checkbox_name(name) in data
607 if not self.is_required and CheckboxInput().value_from_datadict(
608 data, files, self.clear_checkbox_name(name)
609 ):
610 if upload:
611 # If the user contradicts themselves (uploads a new file AND
612 # checks the "clear" checkbox), we return a unique marker
613 # object that FileField will turn into a ValidationError.
614 return FILE_INPUT_CONTRADICTION
615 # False signals to clear any existing value, as opposed to just
616 # None
617 return False
618 return upload
619
620 def value_omitted_from_data(self, data, files, name):
621 return (

Calls 3

clear_checkbox_nameMethod · 0.95
CheckboxInputClass · 0.85
value_from_datadictMethod · 0.45