Skip to main content

Date and time dependend content manipulation

Project description

Date and time dependent content manipulation.

Quick start

  1. Install using pip:

    pip install django-time-wizard
  2. Make sure to follow the installation steps for django-polymorphic

  3. Add to your INSTALLED_APPS:

    'polymorphic',
    'time_wizard',
  4. Include the time_wizard admin URLs in your project urls.py:

    url(^'admin/', include('time_wizard.urls')),
  5. Run python manage.py migrate to create the time_wizard models.

Note

Upgrading from version 0.2.0 to 1.0.0 will delete all the created models of time_wizard!

Usage

You can use the TimeWizard in different ways:

  • use a ForeignKey-relation

    • use one TimeWizardModel-definition for as much models as you want

    • affects your database as the relation needs a new model field

    • example:

      # models.py
      from time_wizard.mixins import TimeWizardMixin
      ...
      class MyModel(TimeWizardMixin, models.Model):
          ...
  • use the PeriodModelInline in the admin

    • each model of yours can have different time-settings

    • does not affect your database as it works with a generic relationship

    • example:

      # models.py
      from time_wizard.mixins import TimeWizardInlineMixin
      ...
      class MyModel(TimeWizardInlineMixin, models.Model):
          ...
      
      # admin.py
      from time_wizard.admin import PeriodModelInline
      from polymorphic.admin import PolymorphicInlineSupportMixin
      ...
      class MyModelAdmin(PolymorphicInlineSupportMixin, admin.ModelAdmin):
          inlines = [PeriodModelInline]
          ...
  • in both ways use is_published on your model to indicate if the content is shown or not.

Settings

Django-time-wizard uses the defined countries and provinces/states from holidays. Definitions need to be compatible with holidays. You can also define this yourself for your needs:

TIME_WIZARD_COUNTRIES = ['US', 'UK', 'DE', ...]
TIME_WIZARD_COUNTRY_PROVINCES = {'US': ['AL', 'AK', ...], ...}

Requirements

  • django

  • django-polymorphic

  • holidays

Tests

Setup your test environment with virtualenv and install the requirements with pip install .. Also install tox via pip and simply run tox.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-time-wizard-1.0.2.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

django_time_wizard-1.0.2-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file django-time-wizard-1.0.2.tar.gz.

File metadata

  • Download URL: django-time-wizard-1.0.2.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.3

File hashes

Hashes for django-time-wizard-1.0.2.tar.gz
Algorithm Hash digest
SHA256 7442f151b8b90b1f85a6a0e433d5914261b4f0eaccddd37f2d8a4129b2f1ce97
MD5 c5c86f1b99cd016dbe3e309727cb9a51
BLAKE2b-256 a00fe180db9418fa4aeaa1a2352b0a9bc7e181af187ae1be212f03d231b60229

See more details on using hashes here.

File details

Details for the file django_time_wizard-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: django_time_wizard-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.5.3

File hashes

Hashes for django_time_wizard-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 30b8e95b22546c570cb3d9c0b221bc857b66aac798a73dcca2d6124e801bd056
MD5 79670e0e03c9c102d6081a4dfafee125
BLAKE2b-256 0de9c72c1d68bce0b48784a911de283b8776efcc5977d6985fcd05e85ee6c1bf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page