PKG-INFO 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. Metadata-Version: 1.1
  2. Name: django-timezone-field
  3. Version: 3.0
  4. Summary: A Django app providing database and form fields for pytz timezone objects.
  5. Home-page: http://github.com/mfogel/django-timezone-field/
  6. Author: Mike Fogel
  7. Author-email: mike@fogel.ca
  8. License: BSD
  9. Description: django-timezone-field
  10. =====================
  11. .. image:: https://img.shields.io/travis/mfogel/django-timezone-field/develop.svg
  12. :target: https://travis-ci.org/mfogel/django-timezone-field/
  13. .. image:: https://img.shields.io/coveralls/mfogel/django-timezone-field/develop.svg
  14. :target: https://coveralls.io/r/mfogel/django-timezone-field/
  15. .. image:: https://img.shields.io/pypi/dm/django-timezone-field.svg
  16. :target: https://pypi.python.org/pypi/django-timezone-field/
  17. A Django app providing database and form fields for `pytz`__ timezone objects.
  18. Examples
  19. --------
  20. Database Field
  21. ~~~~~~~~~~~~~~
  22. .. code:: python
  23. import pytz
  24. from django.db import models
  25. from timezone_field import TimeZoneField
  26. class MyModel(models.Model):
  27. timezone1 = TimeZoneField(default='Europe/London') # defaults supported
  28. timezone2 = TimeZoneField()
  29. timezone3 = TimeZoneField()
  30. my_inst = MyModel(
  31. timezone1='America/Los_Angeles', # assignment of a string
  32. timezone2=pytz.timezone('Turkey'), # assignment of a pytz.DstTzInfo
  33. timezone3=pytz.UTC, # assignment of pytz.UTC singleton
  34. )
  35. my_inst.full_clean() # validates against pytz.common_timezones
  36. my_inst.save() # values stored in DB as strings
  37. tz = my_inst.timezone1 # values retrieved as pytz objects
  38. repr(tz) # "<DstTzInfo 'America/Los_Angeles' PST-1 day, 16:00:00 STD>"
  39. Form Field
  40. ~~~~~~~~~~
  41. .. code:: python
  42. from django import forms
  43. from timezone_field import TimeZoneFormField
  44. class MyForm(forms.Form):
  45. timezone = TimeZoneFormField()
  46. my_form = MyForm({
  47. 'timezone': 'America/Los_Angeles',
  48. })
  49. my_form.full_clean() # validates against pytz.common_timezones
  50. tz = my_form.cleaned_data['timezone'] # values retrieved as pytz objects
  51. repr(tz) # "<DstTzInfo 'America/Los_Angeles' PST-1 day, 16:00:00 STD>"
  52. Installation
  53. ------------
  54. #. From `pypi`__ using `pip`__:
  55. .. code:: sh
  56. pip install django-timezone-field
  57. #. Add `timezone_field` to your `settings.INSTALLED_APPS`__:
  58. .. code:: python
  59. INSTALLED_APPS = (
  60. ...
  61. 'timezone_field',
  62. ...
  63. )
  64. Changelog
  65. ------------
  66. * 3.0 (2018-09-15)
  67. * Support django 1.11, 2.0, 2.1
  68. * Add support for python 3.7
  69. * Change default human-readable timezone names to exclude underscores
  70. (`#32`__ & `#37`__)
  71. * 2.1 (2018-03-01)
  72. * Add support for django 1.10, 1.11
  73. * Add support for python 3.6
  74. * Add wheel support
  75. * Support bytes in DB fields (`#38`__ & `#39`__)
  76. * 2.0 (2016-01-31)
  77. * Drop support for django 1.7, add support for django 1.9
  78. * Drop support for python 3.2, 3.3, add support for python 3.5
  79. * Remove tests from source distribution
  80. * 1.3 (2015-10-12)
  81. * Drop support for django 1.6, add support for django 1.8
  82. * Various `bug fixes`__
  83. * 1.2 (2015-02-05)
  84. * For form field, changed default list of accepted timezones from
  85. `pytz.all_timezones` to `pytz.common_timezones`, to match DB field
  86. behavior.
  87. * 1.1 (2014-10-05)
  88. * Django 1.7 compatibility
  89. * Added support for formating `choices` kwarg as `[[<str>, <str>], ...]`,
  90. in addition to previous format of `[[<pytz.timezone>, <str>], ...]`.
  91. * Changed default list of accepted timezones from `pytz.all_timezones` to
  92. `pytz.common_timezones`. If you have timezones in your DB that are in
  93. `pytz.all_timezones` but not in `pytz.common_timezones`, this is a
  94. backward-incompatible change. Old behavior can be restored by
  95. specifying `choices=[(tz, tz) for tz in pytz.all_timezones]` in your
  96. model definition.
  97. * 1.0 (2013-08-04)
  98. * Initial release as `timezone_field`.
  99. Running the Tests
  100. -----------------
  101. #. Install `tox`__.
  102. #. From the repository root, run
  103. .. code:: sh
  104. tox
  105. Postgres will need to be running locally, and sqlite will need to be
  106. installed in order for tox to do its job.
  107. Found a Bug?
  108. ------------
  109. To file a bug or submit a patch, please head over to `django-timezone-field on github`__.
  110. Credits
  111. -------
  112. Originally adapted from `Brian Rosner's django-timezones`__. The full list of contributors is available on `github`__.
  113. __ http://pypi.python.org/pypi/pytz/
  114. __ http://pypi.python.org/pypi/django-timezone-field/
  115. __ http://www.pip-installer.org/
  116. __ https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
  117. __ https://github.com/mfogel/django-timezone-field/issues/32
  118. __ https://github.com/mfogel/django-timezone-field/issues/37
  119. __ https://github.com/mfogel/django-timezone-field/issues/38
  120. __ https://github.com/mfogel/django-timezone-field/issues/39
  121. __ https://github.com/mfogel/django-timezone-field/issues?q=milestone%3A1.3
  122. __ https://tox.readthedocs.org/
  123. __ https://github.com/mfogel/django-timezone-field/
  124. __ https://github.com/brosner/django-timezones/
  125. __ https://github.com/mfogel/django-timezone-field/graphs/contributors
  126. Platform: UNKNOWN
  127. Classifier: Development Status :: 4 - Beta
  128. Classifier: Environment :: Web Environment
  129. Classifier: Intended Audience :: Developers
  130. Classifier: License :: OSI Approved :: BSD License
  131. Classifier: Operating System :: OS Independent
  132. Classifier: Programming Language :: Python
  133. Classifier: Programming Language :: Python :: 2
  134. Classifier: Programming Language :: Python :: 2.7
  135. Classifier: Programming Language :: Python :: 3
  136. Classifier: Programming Language :: Python :: 3.4
  137. Classifier: Programming Language :: Python :: 3.5
  138. Classifier: Programming Language :: Python :: 3.6
  139. Classifier: Topic :: Utilities
  140. Classifier: Framework :: Django