forms.pyfrom django import forms
from django.contrib.admin import widgets
class SomeForm(forms.Form):
some_field = forms.SplitDateTimeField(label='Some field',
input_date_formats=['%d.%m.%Y'],
input_time_formats=['%H:%M:%S'],
widget=widgets.AdminSplitDateTime())
class Media:
css = {
'all': (
'/static/admin/css/widgets.css',
)
}
js = [
'/admin/jsi18n/',
'/static/admin/js/core.js',
]
form.html<script type="text/javascript">window.__admin_media_prefix__ = "{% static 'admin/' %}";</script>
{{ form.media }}
<form action="{% url 'some_url' %}" method="post">
{% csrf_token %}
<table>
{{ form.as_table }}
</table>
<input type="submit" value="Submit">
</form>