Skip to main content

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:

    path('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.

  • create a custom PeriodModel as a base for custom AbsoluteRange- and HolidayRange-models. There are abstract base classes defined in models/abstract.py. This means you could for example create classes without a generic relation, as PeriodModel itself has.

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.

Tests can also be run via devtools/run-tests. This requires an environment where docker and docker-compose are installed.

Metadata

Release files for django-time-wizard 4.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-time-wizard 4.2.1
File Size Uploaded
django_time_wizard-4.2.1.tar.gz 13.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-time-wizard 4.2.1
File Interpreter ABI Platform
django_time_wizard-4.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.6 kB

Release files / django_time_wizard-4.2.1.tar.gz

Download URL django_time_wizard-4.2.1.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
76378a1cdce40338ebb8944b0add31b9ecea2d318359c656a89336491b67c3be
BLAKE2b-256 checksum
How to use checksums
a0e39482c74c8e9ffc3f2bd059faeee2ce1532eb07375fb710986bf769ee44c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 10, 2025.

Transparency log

Release files / django_time_wizard-4.2.1-py3-none-any.whl

Download URL django_time_wizard-4.2.1-py3-none-any.whl
Size 17.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01e7467ae0277013979afa7f7f5b105a8196c62de0f92955b92926aae9d8a8dc
BLAKE2b-256 checksum
How to use checksums
2ddb5c8b1018d3592425837849c5af07fe3f28dadd890535721191601f898784
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 10, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

4.2.1 This release

2 release files

4.2.0

2 release files

4.1.2

2 release files

4.1.1

2 release files

4.1.0

2 release files

4.0.1

2 release files

4.0.0

2 release files

3.0.2

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page