{"id":17035008,"url":"https://github.com/justquick/django-mx-datetime","last_synced_at":"2026-04-28T21:04:05.691Z","repository":{"id":66561668,"uuid":"11234988","full_name":"justquick/django-mx-datetime","owner":"justquick","description":"Alternate Date, DateTime and Time fields for Django using mx.DateTime","archived":false,"fork":false,"pushed_at":"2015-06-14T21:02:49.000Z","size":142,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-22T22:19:15.924Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/justquick.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-07T15:03:47.000Z","updated_at":"2015-06-14T21:02:49.000Z","dependencies_parsed_at":"2023-02-20T16:45:30.206Z","dependency_job_id":null,"html_url":"https://github.com/justquick/django-mx-datetime","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/justquick/django-mx-datetime","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justquick%2Fdjango-mx-datetime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justquick%2Fdjango-mx-datetime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justquick%2Fdjango-mx-datetime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justquick%2Fdjango-mx-datetime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/justquick","download_url":"https://codeload.github.com/justquick/django-mx-datetime/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justquick%2Fdjango-mx-datetime/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32399050,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T08:45:16.484Z","updated_at":"2026-04-28T21:04:05.653Z","avatar_url":"https://github.com/justquick.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Django MX DateTime\n==================\n\n\n:Author:\n   Justin Quick \u003cjustquick@gmail.com\u003e\n:Version: 0.1.0\n:Release: 0.1.0alpha1\n\n\nDjango MX DateTime uses the `mx.DateTime \u003chttp://www.egenix.com/products/python/mxBase/mxDateTime/\u003e`_ library from `eGenix \u003chttp://www.egenix.com/\u003e`_ to provide alternate Date, DateTime and Time fields for Django.\nIt works by storing the date information in the database in `Julian Day \u003chttps://en.wikipedia.org/wiki/Julian_day\u003e`_ notation where DateFields are represented by IntegerFields and Time/DateTimeFields are represented by FloatFields.\nEach field always returns an `mx.DateTime.DateTime \u003chttp://www.egenix.com/products/python/mxBase/mxDateTime/\u003e`_ instance no matter what the internal type.\n\nFeatures\n--------\n\n- Support for BCE dates\n- Fuzzy parsing logic that can handle inputs like: ``Sun, 14 Jun 1998``, ``January 1 2000``, ``1.1.4004 BCE``, as well as any of the `normal Django input formats \u003chttps://docs.djangoproject.com/en/dev/ref/settings/#date-input-formats\u003e`_.\n\nDrawbacks\n---------\n\n- The following field lookups are not yet supported: ``year``, ``month``, ``day``, and ``week_day``\n- The `admin date_hierarchy \u003chttps://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.date_hierarchy\u003e`_ setting will not work and a work-around has not yet been implemented.\n- The `dates and datetimes \u003chttps://docs.djangoproject.com/en/dev/ref/models/querysets/#dates\u003e`_ queryset methods will always return no results.\n- As of now, only TimeFields and DateTimeFields have not yet been implemented. Timezones are a bitch.\n\n\nInstall\n-------\n\nUse pip for installation. This package requires the `egenix-mx-base \u003chttps://pypi.python.org/pypi/egenix-mx-base\u003e`_ package which means you will need a C compiler.\n\n::\n\n    pip install git+https://github.com/justquick/django-mx-datetime.git#egg=django-mx-datetime\n\nYou may add ``djmx`` to your ``INSTALLED_APPS`` if you wish to test it within your project, but it is not necessary otherwise.\n\nCompatibility\n^^^^^^^^^^^^^\n\nDjango MX DateTime has been tested with all of the following setups\n\n:Django: 1.1, 1.2, 1.3, 1.4, 1.5\n:Python: 2.5, 2.6, 2.7\n:Database: Sqlite3, MySQL, PostgreSQL\n\nUsage\n------\n\nDefine your models using the new fields from the djmx package:\n\n.. code-block:: python\n\n    from django.db import models\n\n    from djmx.fields import DateField\n\n\n    class MyModel(models.Model):\n        name = models.CharField(max_length=255)\n        pub_date = DateField()\n\n        class Meta:\n            ordering = ('-pub_date', )\n\n        def __unicode__(self):\n            return u'%s: (published on %s)' % (self.name, self.pub_date.date)\n\nNotice that for the unicode representation of pub_date you would use ``self.pub_date.date`` because ``self.pub_date`` will always return a ``mx.DateTime.DateTime`` which always contains time information no matter what.\n\nNow you can setup your model in the admin:\n\n.. code-block:: python\n\n    from django.contrib import admin\n\n    from djmx.admin import mx_overrides, date_format\n\n    from .models import MyModel\n\n\n    class MyModelAdmin(admin.ModelAdmin):\n        formfield_overrides = mx_overrides\n        list_display = ('name', 'pub_date_formatted')\n        list_filter = ('pub_date',)\n\n        pub_date_formatted = date_format('pub_date')\n        pub_date_formatted.short_description = 'Publication Date'\n\n    admin.site.register(MyModel, MyModelAdmin)\n\nNotice the ``mx_overrides`` dictionary which sets up the right form fields and widgets for the db fields provided by djmx.\nThe ``date_format`` function returns a classmethod which is used to format a date field to correctly display in the admin and retain proper ordering.\n\nNow your model should be setup to handle all sorts of publication dates. Below is an example of command line usage:\n\nExample\n^^^^^^^\n\n.. code-block:: python\n\n    \u003e\u003e\u003e MyModel.objects.create(name='Y2K', pub_date='January 1 2000')\n    \u003cMyModel: Y2K: (published on 2000-01-01)\u003e\n    \u003e\u003e\u003e obj = MyModel.objects.get(pub_date='January 1 2000')\n    \u003e\u003e\u003e obj.pub_date\n    \u003cmx.DateTime.DateTime object for '2000-01-01 12:00:00.00' at 10da0bd68\u003e\n    \u003e\u003e\u003e obj.pub_date.date\n    '2000-01-01'\n    \u003e\u003e\u003e obj.pub_date.year, obj.pub_date.month, obj.pub_date.day\n    (2000, 1, 1)\n    \u003e\u003e\u003e obj.pub_date.strftime('%A, %d. %B %Y')\n    'Saturday, 01. January 2000'\n    \u003e\u003e\u003e obj.pub_date.pydate()  # Will not work with BCE dates\n    datetime.date(2000, 1, 1)\n    \u003e\u003e\u003e int(obj.pub_date.jdn)  # This is what the database actually stores\n    2451545\n\nTesting\n-------\n\nThe best way to test this package in all circumstances is using `Tox \u003chttp://tox.readthedocs.org/en/latest/\u003e`_. Clone the project and run::\n\n    $ tox\n\nThis will take a long time to download and compile all the packages required.\nIf you are testing database integration, make sure you have a database named \"test\" setup for MySQL and PostgreSQL.\n\nYou can just run the unittests at any point on the standard sqlite3 setup by running::\n\n    $ python djmx/runtests/runtests.py\n\nIf you are using djmx in your project, you can test it like any other Django app::\n\n    $ django-admin.py test djmx","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustquick%2Fdjango-mx-datetime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustquick%2Fdjango-mx-datetime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustquick%2Fdjango-mx-datetime/lists"}