Skip to main content

A reusable Django app to work with opening hours.

Project description

https://travis-ci.org/arteria/django-openinghours.svg?branch=master

A reusable Django app to work with opening hours.

Comes with the following features:

  • Multiple company (premises) support, customisable to directly plug in your own model.
  • Able to show if a company is currently open (“Come in, we’re open!”, “Sorry, we’re closed.”).
  • Able to list the opening hours, e.g. Monday 9am to 5pm, etc. for multiple company premises.
  • Possible to define opening hours passing midnight.
  • Possible to define closing hours, e.g. for holiday.

Installation

To get the latest stable release from PyPi

pip install django-openinghours

To get the latest version from GitHub

pip install -e git+git://github.com/arteria/django-openinghours.git#egg=openinghours-master

Add openinghours to your INSTALLED_APPS

INSTALLED_APPS = (
    ...,
    'openinghours',
)

You can use the company model provided or plug your own using settings.py:

OPENINGHOURS_PREMISES_MODEL = 'yourcastleapp.Castle'

Add the openinghours URLs to your urls.py

urlpatterns = [
    ...
    url(r'^openinghours/', include('openinghours.urls')),
]

Before your tags/filters are available in your templates, load them using

{% load openinghours_tags %}

Create your tables

./manage.py migrate openinghours

Set 'TIME_ZONE' in your project settings.

Usage

Set up a company

This app supports multiple companies (or your custom model) with multiple opening and closing hours.

Set up opening hours

Used to describe when premises are open, defined on a daily basis (per day) by defining one or more start and end times of opening slots.

Optionally, set up the closing hour rules

This is used to define when premises are closed (e.g. due to a holiday, absences, sickness or similar). Please note that the closing hours override the opening hours.

You can find examples of how to use this app in our templates.

Remarks

Opening hours is built using datetime’s isoweekday. This means Monday is represented by number 1 and Sunday by 7.

Planned features

Priority 1 = high/must have, 2 = and 3 = low/nice to have

  • 1 Migrate to Django’s timezone
  • 2 Docs for live testing of defined rules
  • 3 Shortcut for everyday (1-7) = 0 in WEEKDAYS, or 8 = monday to friday, etc.
  • 3 Global closing hours to override all companies. Use cases: close a whole shopping centre

See also CHANGELOG and UPGRADING docs.

Contribute

Just send us your pull request. File and issue. Use it. Talk about it. Thank you

Project details


Release history Release notifications

This version
History Node

0.1.3

History Node

0.1.2

History Node

0.1.1

History Node

0.0.36

History Node

0.0.35

History Node

0.0.34

History Node

0.0.33

History Node

0.0.32

History Node

0.0.29

History Node

0.0.26

History Node

0.0.25

History Node

0.0.24

History Node

0.0.23

History Node

0.0.22

History Node

0.0.21

History Node

0.0.20

History Node

0.0.19

History Node

0.0.18

History Node

0.0.17

History Node

0.0.16

History Node

0.0.15

History Node

0.0.14

History Node

0.0.13

History Node

0.0.12

History Node

0.0.11

History Node

0.0.10

History Node

0.0.9

History Node

0.0.8

History Node

0.0.7

History Node

0.0.6

History Node

0.0.5

History Node

0.0.4

History Node

0.0.3

History Node

0.0.1

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
django-openinghours-0.1.3.tar.gz (15.1 kB) Copy SHA256 hash SHA256 Source None May 29, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page