vkk.generic.forms
A collection of reusable and extendable input and form classes.
1""" 2A collection of reusable and extendable input and form 3classes. 4""" 5 6from django.forms import DateInput, DateTimeInput, Form, CharField 7from django.utils.translation import gettext_lazy as _ 8 9 10class CustomDateInput(DateInput): 11 """ 12 This subclass of `DateInput` provides the HTML input type "date" for widgets. 13 """ 14 input_type = 'date' 15 16 def format_value(self, value): 17 return value 18 19 20class CustomDateTimeInput(DateTimeInput): 21 """ 22 This subclass of `DateTimeInput` provides the HTML input type "datetime-local" 23 for widgets. 24 """ 25 input_type = 'datetime-local' 26 27 def format_value(self, value): 28 return value 29 30 31class FilterForm(Form): 32 """ 33 A generic form used for simple text based queries. 34 """ 35 query = CharField( 36 label=_('Query'), 37 max_length=255, 38 required=False, 39 strip=True 40 )
class
CustomDateInput(django.forms.widgets.DateInput):
11class CustomDateInput(DateInput): 12 """ 13 This subclass of `DateInput` provides the HTML input type "date" for widgets. 14 """ 15 input_type = 'date' 16 17 def format_value(self, value): 18 return value
This subclass of DateInput
provides the HTML input type "date" for widgets.
Inherited Members
- django.forms.widgets.DateTimeBaseInput
- DateTimeBaseInput
- supports_microseconds
- format
- django.forms.widgets.DateInput
- format_key
- template_name
- django.forms.widgets.Input
- get_context
- django.forms.widgets.Widget
- needs_multipart_form
- is_localized
- is_required
- use_fieldset
- attrs
- subwidgets
- render
- build_attrs
- value_from_datadict
- value_omitted_from_data
- id_for_label
- use_required_attribute
class
CustomDateTimeInput(django.forms.widgets.DateTimeInput):
21class CustomDateTimeInput(DateTimeInput): 22 """ 23 This subclass of `DateTimeInput` provides the HTML input type "datetime-local" 24 for widgets. 25 """ 26 input_type = 'datetime-local' 27 28 def format_value(self, value): 29 return value
This subclass of DateTimeInput
provides the HTML input type "datetime-local"
for widgets.
Inherited Members
- django.forms.widgets.DateTimeBaseInput
- DateTimeBaseInput
- supports_microseconds
- format
- django.forms.widgets.DateTimeInput
- format_key
- template_name
- django.forms.widgets.Input
- get_context
- django.forms.widgets.Widget
- needs_multipart_form
- is_localized
- is_required
- use_fieldset
- attrs
- subwidgets
- render
- build_attrs
- value_from_datadict
- value_omitted_from_data
- id_for_label
- use_required_attribute
class
FilterForm(django.forms.forms.Form):
32class FilterForm(Form): 33 """ 34 A generic form used for simple text based queries. 35 """ 36 query = CharField( 37 label=_('Query'), 38 max_length=255, 39 required=False, 40 strip=True 41 )
A generic form used for simple text based queries.
Inherited Members
- django.forms.forms.BaseForm
- BaseForm
- default_renderer
- field_order
- prefix
- use_required_attribute
- template_name_div
- template_name_p
- template_name_table
- template_name_ul
- template_name_label
- is_bound
- data
- files
- auto_id
- initial
- error_class
- label_suffix
- empty_permitted
- fields
- renderer
- order_fields
- errors
- is_valid
- add_prefix
- add_initial_prefix
- template_name
- get_context
- non_field_errors
- add_error
- has_error
- full_clean
- clean
- has_changed
- changed_data
- is_multipart
- visible_fields
- get_initial_for_field
- django.forms.utils.RenderableFormMixin
- as_p
- as_table
- as_ul
- as_div
- django.forms.utils.RenderableMixin
- render