widgets.py
# coding: utf-8
from __future__ import unicode_literals
from __future__ import absolute_import
from django import forms
class DateTimeWidget(forms.SplitDateTimeWidget):
"""
A Widget that splits datetime input into two <input type="date"> and <input type="time"> inputs.
"""
def __init__(self, attrs=None, date_format=None, time_format=None):
super(DateTimeWidget, self).__init__(attrs, date_format, time_format)
self.widgets[0].input_type = "date"
self.widgets[1].input_type = "time"
Recommended Posts