This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Here is how it looks like.

Written on top of django-timezone-field.

A Django app providing database and form fields for split datetime/time and pytz timezone objects.

  • Use SplitDateTimeTimeZoneField in place of forms.DateTimeField.
  • Use SplitTimeTimeZoneField in place of forms.TimeField.

The setting USE_TZ_FIELDS = True will convert all admin.ModelAdmin to use SplitDateTimeTimeZoneField for models.DateTimeField and SplitTimeTimeZoneField for models.TimeField.

Requires USE_TZ = True in settings.py

Note

If using a database that does not support timezone-aware times then the initial values of model forms will always be in the UTC timezone.

Form Field

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())

Installation

  1. From pypi using pip:

    pip install django-datetimezone-field
    
  2. Add timezone_field and datetimezone_field to your settings.INSTALLED_APPS

INSTALLED_APPS = (
    ...
    timezone_field,
    datetimezone_field,
    ...
)

Running sample project

  1. cd test/sample_project
  2. virtualenv sample-env
  3. source sample-env/bin/activate
  4. pip install -r requirements.txt
  5. python manage.py syncdb
  6. python manage.py runserver

TODO

  1. Unit tests

Found a Bug?

To file a bug or submit a patch, please head over to django-datetimezone-field on github.

Credits

Built on top of Mike Fogel’s django-timezone-field.

Release History

Release History

0.1.8

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.7

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.6

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-datetimezone-field-0.1.8.tar.gz (4.8 kB) Copy SHA256 Checksum SHA256 Source Oct 9, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting