i'm using AdminSplitDateTime in a model form that i use as a form_class in a CreateView.
when i used this in windows with django version 1.8.3 with runserver
i could save dates in the format: yyyy-mm-dd (2015-12-17) hh:mm:ss (09:22:24)
when i moved my project to ubuntu and upgraded my django to 1.9 and ran
it with gunicorn and nginx it error "Enter a valid date/time."
but when i saved it in the admin page with DateTimeField it ran just fine.
does anyone know why it had problems when i tried to save it with the form?
Though you probably solved this on your own in the past 3 months I stumbled upon your question while dealing with a similar issue.
The behavior of this widget has changed in Django 1.9, as mentioned in the release notes:
The ability to use a SplitDateTimeWidget with DateTimeField is removed.
SplitDateTimeWidget now requires django.form.SplitDateTimeField instead of django.forms.DateTimefield. Same applies for the AdminSplitDateTime from django.contrib.admin.widgets, obviously.
Example
from django import forms
from django.contrib.admin import widgets
class CustomForm(forms.Form):
    mydatetime = forms.SplitDateTimeField(widget=widgets.AdminSplitDateTime())
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With