Screenshots - GradConnection/django-datetimezone-field GitHub Wiki
With USE_TZ_FIELDS=True, replacing the Django admin's AdminSplitDateTime widget:
Add form defaults to settings.TIME_ZONE

Change form defaults to the timezone of the date as stored in the database
SQLite only stores naive datetimes. Use Postgres to store timezone with dates.

Grappelli compatibility

Using the module in a typical Django view:
import pytz
from django import http
from django import forms
from django.utils import timezone
from django.forms.util import to_current_timezone
from django.conf import settings
from datetimezone_field import SplitDateTimeTimeZoneField, \
SplitTimeTimeZoneField
def index(request):
class MyForm(forms.Form):
a_datetime = SplitDateTimeTimeZoneField()
a_time = SplitTimeTimeZoneField()
tz = pytz.timezone("Australia/Sydney")
timezone.activate(tz)
now = to_current_timezone(timezone.now()).replace(tzinfo=tz)
my_form = MyForm(initial={
'a_datetime': now,
'a_time': now.time().replace(tzinfo=now.tzinfo)
})
return http.HttpResponse(my_form.as_p())
