UnixDateTimeField in Django
Project description
Provides a UnixDateTimeField to represent date and time stored as Unix time (http://en.wikipedia.org/wiki/Unix_time). It’s based on the implementation of the standard Django DateTimeField, making UnixDateTimeField 100% compatible with all options it supports.
Usage
First you’ll need to attach a UnixDateTimeField to your model. This acts as a the equivalence of a Django PositiveIntegerField at the database level but provides a Django DateTimeField at the ORM abstraction layer.
Example model:
from django_unixdatetimefield import UnixDateTimeField class MyModel(models.Model): created_at = UnixDateTimeField()
Python ORM query:
>>> m = MyModel() >>> m.created_at = datetime.datetime(2015, 2, 21, 19, 38, 32, 209148) >>> m.save()
Database:
sqlite> select created_at from mymodel; 1426967129
Installation
Install it with pip (or easy_install):
pip install django-unixdatetimefield
License
BSD, just as the main Django project. See LICENSE file in root of this repo.
Contributing
This project accepts contributions via GitHub pull requests.
follow Google’s Python style guide https://google-styleguide.googlecode.com/svn/trunk/pyguide.html
make commits of logical units, messages should include what changed and why and be written in past tense
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-unixdatetimefield-0.1.2.tar.gz
.
File metadata
- Download URL: django-unixdatetimefield-0.1.2.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1c8f3d24bb4016085a6b7f0661bbb5cea69536d8392769f3802bb7b4ac9703c |
|
MD5 | c1505e3ef0edfb8cdd3866827eea9fe3 |
|
BLAKE2b-256 | 58c50c0244d941db2fff777ca341d0575e72dafe196bdf7b0aa7db7d0f6b352b |