From 15fc7e5e3de7e6ce3dce5819176ab33144f3f330 Mon Sep 17 00:00:00 2001 From: Michal Dabski Date: Mon, 17 May 2021 13:10:25 +0100 Subject: [PATCH] Append field's default values to Widget As per Dajngo's default form renderer, a hidden field should be appended containing default value if `show_hidden_initial=True` --- src/bootstrap3/renderers.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bootstrap3/renderers.py b/src/bootstrap3/renderers.py index 7c777d91..51cade16 100644 --- a/src/bootstrap3/renderers.py +++ b/src/bootstrap3/renderers.py @@ -478,6 +478,8 @@ def _render(self): # Render the widget self.add_widget_attrs() html = self.field.as_widget(attrs=self.widget.attrs) + if self.field.field.show_hidden_initial: + html += self.field.as_hidden(only_initial=True) self.restore_widget_attrs() # Start post render html = self.post_widget_render(html)