html5.py 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. """
  2. Fields to support various HTML5 input types.
  3. """
  4. from ..widgets import html5 as widgets
  5. from . import core
  6. __all__ = (
  7. 'DateField', 'DateTimeField', 'DateTimeLocalField', 'DecimalField',
  8. 'DecimalRangeField', 'EmailField', 'IntegerField', 'IntegerRangeField',
  9. 'SearchField', 'TelField', 'URLField',
  10. )
  11. class SearchField(core.StringField):
  12. """
  13. Represents an ``<input type="search">``.
  14. """
  15. widget = widgets.SearchInput()
  16. class TelField(core.StringField):
  17. """
  18. Represents an ``<input type="tel">``.
  19. """
  20. widget = widgets.TelInput()
  21. class URLField(core.StringField):
  22. """
  23. Represents an ``<input type="url">``.
  24. """
  25. widget = widgets.URLInput()
  26. class EmailField(core.StringField):
  27. """
  28. Represents an ``<input type="email">``.
  29. """
  30. widget = widgets.EmailInput()
  31. class DateTimeField(core.DateTimeField):
  32. """
  33. Represents an ``<input type="datetime">``.
  34. """
  35. widget = widgets.DateTimeInput()
  36. class DateField(core.DateField):
  37. """
  38. Represents an ``<input type="date">``.
  39. """
  40. widget = widgets.DateInput()
  41. class DateTimeLocalField(core.DateTimeField):
  42. """
  43. Represents an ``<input type="datetime-local">``.
  44. """
  45. widget = widgets.DateTimeLocalInput()
  46. class IntegerField(core.IntegerField):
  47. """
  48. Represents an ``<input type="number">``.
  49. """
  50. widget = widgets.NumberInput(step='1')
  51. class DecimalField(core.DecimalField):
  52. """
  53. Represents an ``<input type="number">``.
  54. """
  55. widget = widgets.NumberInput(step='any')
  56. class IntegerRangeField(core.IntegerField):
  57. """
  58. Represents an ``<input type="range">``.
  59. """
  60. widget = widgets.RangeInput(step='1')
  61. class DecimalRangeField(core.DecimalField):
  62. """
  63. Represents an ``<input type="range">``.
  64. """
  65. widget = widgets.RangeInput(step='any')