mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #34119 -- Prevented callable default hidden widget value from being overridden.
Thanks to Benjamin Rigaud for the report.
This commit is contained in:
committed by
Mariusz Felisiak
parent
04b15022e8
commit
25904db915
@@ -96,9 +96,17 @@ class BoundField:
|
||||
attrs.setdefault(
|
||||
"id", self.html_initial_id if only_initial else self.auto_id
|
||||
)
|
||||
if only_initial and self.html_initial_name in self.form.data:
|
||||
# Propagate the hidden initial value.
|
||||
value = self.form._widget_data_value(
|
||||
self.field.hidden_widget(),
|
||||
self.html_initial_name,
|
||||
)
|
||||
else:
|
||||
value = self.value()
|
||||
return widget.render(
|
||||
name=self.html_initial_name if only_initial else self.html_name,
|
||||
value=self.value(),
|
||||
value=value,
|
||||
attrs=attrs,
|
||||
renderer=self.form.renderer,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user