Giter Club home page Giter Club logo

django-openinghours's Introduction

Django Opening Hours

image

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

django-openinghours's People

Contributors

bitdeli-chef avatar fmalina avatar imposeren avatar jminuscula avatar jvamvas avatar melnichevv avatar ompemi avatar philippeowagner avatar vlinhart avatar walterrenner avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

artiststechguy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.