diff --git a/reforms/templates/forms/date.html b/reforms/templates/forms/date.html new file mode 100644 index 0000000..6f66ae4 --- /dev/null +++ b/reforms/templates/forms/date.html @@ -0,0 +1 @@ +{% include "input.html" %} diff --git a/reforms/widgets.py b/reforms/widgets.py index e713a37..332d8fd 100644 --- a/reforms/widgets.py +++ b/reforms/widgets.py @@ -4,7 +4,15 @@ import jinja2 from markupsafe import Markup -__all__ = ("BaseWidget", "Input", "TextInput", "EmailInput", "Checkbox", "HiddenInput") +__all__ = ( + "BaseWidget", + "Input", + "TextInput", + "EmailInput", + "Checkbox", + "HiddenInput", + "DateInput", +) class BaseWidget: @@ -89,3 +97,8 @@ class Checkbox(Input): class HiddenInput(Input): input_type: str = "hidden" template: str = "hidden.html" + + +class DateInput(Input): + input_type: str = "date" + template: str = "date.html" diff --git a/tests/test_widgets.py b/tests/test_widgets.py index f101baf..2f37b95 100644 --- a/tests/test_widgets.py +++ b/tests/test_widgets.py @@ -6,6 +6,7 @@ from reforms.widgets import ( BaseWidget, Checkbox, + DateInput, EmailInput, HiddenInput, Input, @@ -17,6 +18,7 @@ EmailInput, TextInput, HiddenInput, + DateInput, ) input_widgets = ( @@ -24,6 +26,7 @@ EmailInput, TextInput, HiddenInput, + DateInput, ) widgets_with_placeholder = [w for w in input_widgets if w is not Checkbox]