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

Method get_context

django/forms/widgets.py:586–602  ·  view source on GitHub ↗
(self, name, value, attrs)

Source from the content-addressed store, hash-verified

584 return value
585
586 def get_context(self, name, value, attrs):
587 context = super().get_context(name, value, attrs)
588 checkbox_name = self.clear_checkbox_name(name)
589 checkbox_id = self.clear_checkbox_id(checkbox_name)
590 context["widget"].update(
591 {
592 "checkbox_name": checkbox_name,
593 "checkbox_id": checkbox_id,
594 "is_initial": self.is_initial(value),
595 "input_text": self.input_text,
596 "initial_text": self.initial_text,
597 "clear_checkbox_label": self.clear_checkbox_label,
598 }
599 )
600 context["widget"]["attrs"].setdefault("disabled", False)
601 context["widget"]["attrs"]["checked"] = self.checked
602 return context
603
604 def value_from_datadict(self, data, files, name):
605 upload = super().value_from_datadict(data, files, name)

Callers

nothing calls this directly

Calls 6

clear_checkbox_nameMethod · 0.95
clear_checkbox_idMethod · 0.95
is_initialMethod · 0.95
get_contextMethod · 0.45
updateMethod · 0.45
setdefaultMethod · 0.45

Tested by

no test coverage detected