Giter Club home page Giter Club logo

django-reservations's Introduction

django-reservations

A simple and customizable Django module for handling reservations.

Sample app screenshot using django-reservations

Features

  • Customizable reservations (you can provide your own reservation model)
  • Configurable (single/multiple reservations per day, default free spots, reservations per month)
  • Automatic customizable emails with reservation details
  • Custom Django Admin backend
  • Ajax calendar for reservation creation and handling
  • UI based on Twitter Bootstrap
  • Using i18n to handle translations

Usage

You can use django-reseravations as any other django module. You have to add it to your Python PATH. After this add 'reservations' to your INSTALLED_APPS in settings.py. Also you need to set RESERVATION_SPOTS_TOTAL setting so app knows what is the reservations number limit per day. Add it to your urls.py:

urlpatterns = patterns('',
    # ...
    url(r'^reservations/', include('reservations.urls')),
    # ...
)

After these basic steps you are ready to go. Just run manage.py syncdb to create suitable database models. The reservation app will be available under the URL /reservations/calendar. Visit it to see how it works and how it looks like ;)

Customization

You can also set some other settings to customize it further:

RESERVATIONS_PER_MONTH (unlimited by default) - how many reservations can a single user create during one month RESERVATIONS_PER_DAY (unlimited by default) - how many reservations can a single user create on one day (for example user should not be able to make more than one reservation per day)

If you would like to add some extra data for each reservation (gender, nationality, whatever..) you can inherit Reservation model and extend it with you custom fields. After that the model will automatically use you new model (and it will update the UI too!). All the Django validation will work too (via ajax!).

The simplest way is to create a new app inside your project (myreservations for example) and add it to your INSTALLED_APPS. In your new app create models.py in which you will inherit from Reservation model. After creating your custom model you need to call update_model so Resevations module knows about your new model.

from django.db import models
from reservations import update_model
from reservations.models import Reservation

RACE = (
        ('alien', 'Killing Machine'),
        ('android', 'Artificial Inteligence'),
        ('human', 'Ordinary Guy'),
    )

class DetailedReservation(Reservation):
    """Your extra data for the basic model"""
    shoe_number = models.IntegerField()
    race = models.CharField(max_length=32, choices=RACE)

    def short_desc(self):
        """Displayed on the reservation removal button"""
        return str(self.id) + "/" + str(self.race)

update_model(DetailedReservation)

Customizing emails that are sent when reservation is being made can be easily done by creating email_new.html template file. Data available in the template is described below. You can check email_new.html template in reservations module for reference.

{'name': username_of_the_user_that_made_a_reservation,
'date': date_of_the_reservation,
'reservation_id': reservation_id,
'extra_data': form_with_extra_data,
'domain': APP_URL_setting}

Testing

Project has full unit test coverage of the backend. After adding it to your Django project you can run tests from your shell.

./manage.py test reservations

Continuous Integration status

TODOs

  • Sample app using Django reservations
  • Implemenging user requested features

Got some questions or suggestions? Mail me directly or use the issue tracker.

django-reservations's People

Contributors

bernii avatar

Watchers

James Cloos avatar

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.