{ "info": { "author": "Darren O'Neill", "author_email": "darren@pixeldomain.co.uk", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Internet" ], "description": "Django DateTimeUTC\n==================\n\ndjango-datetime-utc provides ``DateTimeUTCField``, a naive datetime model field.\nIn PostgreSQL this translates to the field *timestamp without time zone*.\nAll timestamps are saved in UTC.\n\n\nWhy use this?\n-------------\nThe problem with using Django's ``DateTimeField`` is unless the default timezone\non your (PostgreSQL) database server is set to UTC it doesn't matter which TZ\nsettings you select in Django, PostgreSQL will save all timestamps in local time\nwith an offset.\n\nFeatures\n--------\n\n- Supports the default ``DateTimeField`` options such as ``auto_now_add`` and ``auto_now``\n- Works with South\n- Saves all timestamps in UTC\n- Values automatically converted to local time (specified by ``TIME_ZONE`` in your project settings.py) in forms and templates\n\nInstall\n-------\nFrom PyPi:\n::\n\n $ pip install django-datetime-utc\n\nIn ``settings.py`` add ``datetimeutc`` to the list of installed apps, set your\nlocal time zone and ensure time zone support is enabled:\n::\n\n TIME_ZONE = 'Europe/London'\n USE_TZ = True\n INSTALLED_APPS = (\n #...\n 'datetimeutc',\n )\n\nUsage\n-----\nIn ``models.py``:\n::\n\n from django.db import models\n from datetimeutc.fields import DateTimeUTCField\n\n class Stuff(models.Model):\n title = models.CharField(max_length=100)\n stuff_time = DateTimeUTCField()\n submitted = DateTimeUTCField(auto_now_add=True)\n\nNotes\n-----\n\nIf your code creates datetime objects, they should always be TZ aware so they\nare automatically converted correctly to UTC (if necessary) before being saved\nto the database. Using the ``Stuff`` model above as an example, to set\n``stuff_time`` correctly you would:\n::\n\n import datetime\n from dateutil import tz\n\n utcnow = datetime.datetime.utcnow().replace(tzinfo=tz.gettz('UTC'))\n Stuff.objects.create(title='My stuff', stuff_time=utcnow)\n\nThis also goes for user defined datetime objects. For example in the admin\npanel, if the user submits a value for ``stuff_time``, in ``admin.py`` you\nwould:\n::\n\n from dateutil import tz\n from django.contrib import admin\n from django.conf import settings\n from stuff.models import Stuff\n\n\n class StuffAdmin(admin.ModelAdmin):\n def save_model(self, request, obj, form, change):\n obj.stuff_time = obj.stuff_time.replace(\n tzinfo=tz.gettz(settings.TIME_ZONE))\n super(StuffAdmin, self).save_model(request, obj, form, change)\n\n admin.site.register(Stuff, StuffAdmin)\n\nHere the datetime object is made TZ aware by setting the time zone to the\none specified in ``settings.py`` (presumably the time zone of the user\nentering this data). This will be converted to UTC prior to save automatically.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/pixeldomain/django-datetime-utc", "keywords": "django,timestamp without time zone,utc,datetime", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "django-datetime-utc", "package_url": "https://pypi.org/project/django-datetime-utc/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-datetime-utc/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/pixeldomain/django-datetime-utc" }, "release_url": "https://pypi.org/project/django-datetime-utc/1.0.2/", "requires_dist": null, "requires_python": null, "summary": "Django UTC datetime field - timestamp without time zone", "version": "1.0.2" }, "last_serial": 2003210, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "3e6bc35625387343380753f94aa10248", "sha256": "99262e1ce8882a688d1afd986032aca0510f8afee14a70f349a85205e96a7e79" }, "downloads": -1, "filename": "django-datetime-utc-1.0.0.tar.gz", "has_sig": false, "md5_digest": "3e6bc35625387343380753f94aa10248", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3085, "upload_time": "2014-05-24T11:50:54", "url": "https://files.pythonhosted.org/packages/42/76/47391d836138a53aa2591486e90a8a733dced96c2ac5e699eb179cd9191c/django-datetime-utc-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "fe76ecd091578b0768791696be6e396b", "sha256": "0003bfecd3ae719f3569f26987e606fa899cde94e8b078b27b1010ab6d00cb19" }, "downloads": -1, "filename": "django-datetime-utc-1.0.1.tar.gz", "has_sig": false, "md5_digest": "fe76ecd091578b0768791696be6e396b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3323, "upload_time": "2014-08-09T18:36:26", "url": "https://files.pythonhosted.org/packages/5f/c3/69c337a9cdb1ab76d08094ef7eda67baf5d1ad3794e4391707589e8d82aa/django-datetime-utc-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "1e2213f46fe19236ab48ef9df505b78e", "sha256": "0205941b7fe0ac3bbb305e45a39e3049891688c8574c2aa09ba684bce73f7a1f" }, "downloads": -1, "filename": "django-datetime-utc-1.0.2.tar.gz", "has_sig": false, "md5_digest": "1e2213f46fe19236ab48ef9df505b78e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3324, "upload_time": "2016-03-12T16:53:26", "url": "https://files.pythonhosted.org/packages/40/fa/f9ace2fd54c4984fa74840bbed57af4e7d931718b13bd8ba087b7ad5e5bc/django-datetime-utc-1.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1e2213f46fe19236ab48ef9df505b78e", "sha256": "0205941b7fe0ac3bbb305e45a39e3049891688c8574c2aa09ba684bce73f7a1f" }, "downloads": -1, "filename": "django-datetime-utc-1.0.2.tar.gz", "has_sig": false, "md5_digest": "1e2213f46fe19236ab48ef9df505b78e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3324, "upload_time": "2016-03-12T16:53:26", "url": "https://files.pythonhosted.org/packages/40/fa/f9ace2fd54c4984fa74840bbed57af4e7d931718b13bd8ba087b7ad5e5bc/django-datetime-utc-1.0.2.tar.gz" } ] }