Source

django-public-holidays / README.rst

django-public-holidays

A django app that contains tools and models for working with Public Holidays.

Usage

  • add public_holidays to your settings.INSTALLED_APPS

  • update the database tables for public_holidays:

    $ python manage.py syncdb

    or

    $ django-admin.py syncdb

  • A new item will be created in your admin, which allows you to view and update public holidays.

Notes

A PublicHoliday object has a name, a date and a country. All of these are required, which does mean for something like Christmas Day, you may have many holidays on the same day, but this seemed like the best way to handle it.

A PublicHoliday may also have a list of provinces/states/districts (the name will depend upon the country selected), which are where the holiday is in effect. If no values exist in this list, that means the holiday applies to the whole country. The list of possible provinces is gleaned from django.contrib.localflavor, but if the country is not found in that app, you can enter your own values. This should be a python/json list of strings.

This app was written to allow one of my projects to determine if a given date was a public holiday for wage purposes. The employer/workplace also has an attribute which is a province, and this is used to see if a holiday in a certain country is active for this workplace.

Requirements

You should have the following installed:

Basically, your pip REQUIREMENTS.txt file should contain lines similar to:

Django
-e hg+http://bitbucket.org/schinckel/django-jsonfield#egg=django-jsonfield
-e hg+http://bitbucket.org/schinckel/django-countries#egg=django-countries
-e hg+http://bitbucket.org/schinckel/django-public-holidays#egg=django-public-holidays