mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
38 lines
903 B
Python
38 lines
903 B
Python
![]() |
from django import forms
|
||
|
|
||
|
__all__ = (
|
||
|
'DatePicker',
|
||
|
'DateTimePicker',
|
||
|
'TimePicker',
|
||
|
)
|
||
|
|
||
|
|
||
|
class DatePicker(forms.TextInput):
|
||
|
"""
|
||
|
Date picker using Flatpickr.
|
||
|
"""
|
||
|
def __init__(self, *args, **kwargs):
|
||
|
super().__init__(*args, **kwargs)
|
||
|
self.attrs['class'] = 'date-picker'
|
||
|
self.attrs['placeholder'] = 'YYYY-MM-DD'
|
||
|
|
||
|
|
||
|
class DateTimePicker(forms.TextInput):
|
||
|
"""
|
||
|
DateTime picker using Flatpickr.
|
||
|
"""
|
||
|
def __init__(self, *args, **kwargs):
|
||
|
super().__init__(*args, **kwargs)
|
||
|
self.attrs['class'] = 'datetime-picker'
|
||
|
self.attrs['placeholder'] = 'YYYY-MM-DD hh:mm:ss'
|
||
|
|
||
|
|
||
|
class TimePicker(forms.TextInput):
|
||
|
"""
|
||
|
Time picker using Flatpickr.
|
||
|
"""
|
||
|
def __init__(self, *args, **kwargs):
|
||
|
super().__init__(*args, **kwargs)
|
||
|
self.attrs['class'] = 'time-picker'
|
||
|
self.attrs['placeholder'] = 'hh:mm:ss'
|