Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions reforms/templates/forms/date.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% include "input.html" %}
15 changes: 14 additions & 1 deletion reforms/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"
3 changes: 3 additions & 0 deletions tests/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from reforms.widgets import (
BaseWidget,
Checkbox,
DateInput,
EmailInput,
HiddenInput,
Input,
Expand All @@ -17,13 +18,15 @@
EmailInput,
TextInput,
HiddenInput,
DateInput,
)

input_widgets = (
Checkbox,
EmailInput,
TextInput,
HiddenInput,
DateInput,
)

widgets_with_placeholder = [w for w in input_widgets if w is not Checkbox]
Expand Down