html5.py 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. from wtforms import TextField
  2. from wtforms import IntegerField as _IntegerField
  3. from wtforms import DecimalField as _DecimalField
  4. from wtforms import DateField as _DateField
  5. from wtforms.widgets import Input
  6. class DateInput(Input):
  7. """
  8. Creates `<input type=date>` widget
  9. """
  10. input_type = "date"
  11. class NumberInput(Input):
  12. """
  13. Creates `<input type=number>` widget
  14. """
  15. input_type="number"
  16. class RangeInput(Input):
  17. """
  18. Creates `<input type=range>` widget
  19. """
  20. input_type="range"
  21. class URLInput(Input):
  22. """
  23. Creates `<input type=url>` widget
  24. """
  25. input_type = "url"
  26. class EmailInput(Input):
  27. """
  28. Creates `<input type=email>` widget
  29. """
  30. input_type = "email"
  31. class SearchInput(Input):
  32. """
  33. Creates `<input type=search>` widget
  34. """
  35. input_type = "search"
  36. class TelInput(Input):
  37. """
  38. Creates `<input type=tel>` widget
  39. """
  40. input_type = "tel"
  41. class SearchField(TextField):
  42. """
  43. **TextField** using **SearchInput** by default
  44. """
  45. widget = SearchInput()
  46. class DateField(_DateField):
  47. """
  48. **DateField** using **DateInput** by default
  49. """
  50. widget = DateInput()
  51. class URLField(TextField):
  52. """
  53. **TextField** using **URLInput** by default
  54. """
  55. widget = URLInput()
  56. class EmailField(TextField):
  57. """
  58. **TextField** using **EmailInput** by default
  59. """
  60. widget = EmailInput()
  61. class TelField(TextField):
  62. """
  63. **TextField** using **TelInput** by default
  64. """
  65. widget = TelInput()
  66. class IntegerField(_IntegerField):
  67. """
  68. **IntegerField** using **NumberInput** by default
  69. """
  70. widget = NumberInput()
  71. class DecimalField(_DecimalField):
  72. """
  73. **DecimalField** using **NumberInput** by default
  74. """
  75. widget = NumberInput()
  76. class IntegerRangeField(_IntegerField):
  77. """
  78. **IntegerField** using **RangeInput** by default
  79. """
  80. widget = RangeInput()
  81. class DecimalRangeField(_DecimalField):
  82. """
  83. **DecimalField** using **RangeInput** by default
  84. """
  85. widget = RangeInput()