Code Monkey home page Code Monkey logo

django-booking's Introduction

Django Booking

A reusable Django app that manages bookings for various purposes.

Installation

To get the latest stable release from PyPi

$ pip install django-booking

To get the latest commit from GitHub

$ pip install -e git+git://github.com/bitmazk/django-booking.git#egg=booking

TODO: Describe further installation steps (edit / remove the examples below):

Add booking to your INSTALLED_APPS

INSTALLED_APPS = (
    ...,
    'booking',
)

Add the booking URLs to your urls.py

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

Don't forget to migrate your database

./manage.py migrate booking

Usage

If you allow anonymous bookings, the session object is stored within the booking model. Otherwise it will be connected to the User model.

NOTE: If a session is destroyed, the connected booking model will also be removed.

In order to allow login via email and booking ID, please add this to your AUTHENTICATION_BACKENDS:

AUTHENTICATION_BACKENDS = (
    # your usual auth backends
    'booking.auth_backends.BookingIDBackend',
)

At the moment you will have to write a new view that will render the booking.forms.BookingIDAuthenticationForm. If the form is valid, your view should call auth_login(request, form.get_user()), similar to Django's original login view.

Settings

BOOKING_STATUS_CREATED

Default: 'pending'

Slug of the BookingStatus, which should be added after booking creation.

BOOKING_TIME_INTERVAL

Default: ''

The default value for the time_unit attribute of the Booking. Set it in case you need to specify that you want to book something e.g. X days or Y hours. Set it to the singular of that time unit::

BOOKING_TIME_INTERVAL = 'day'

Error logging

In case you want to add error logging especially for booking processes, we provide a BookingError model, in which you can store:

booking (FK to Booking - required) The booking during this error occurred.
message (Char) The short error message, that you need to store.
details (Text) A more in depth text about the error or any kind of additional information, e.g. a traceback.

Contribute

If you want to contribute to this project, please perform the following steps

# Fork this repository
# Clone your fork
mkvirtualenv -p python2.7 django-booking
make develop

git co -b feature_branch master
# Implement your feature and tests
git add . && git commit
git push -u origin feature_branch
# Send us a pull request for your feature branch

In order to run the tests, simply execute tox. This will install two new environments (for Django 1.8 and Django 1.9) and run the tests against both environments.

django-booking's People

Contributors

mbrochh avatar pydanny avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-booking's Issues

migration doesn't work for me neither

Hello,

the migration process does not work.
I'm using Python 2.7 and django 1.10.

Error is:

Traceback (most recent call last):
File "manage.py", line 22, in
execute_from_command_line(sys.argv)
File "/home/richard/programmation/python/django_projects/django_booking_env/local/lib/python2.7/site-packages/django/core/management/init.py", line 367, in execute_from_command_line
utility.execute()
File "/home/richard/programmation/python/django_projects/django_booking_env/local/lib/python2.7/site-packages/django/core/management/init.py", line 341, in execute
django.setup()
File "/home/richard/programmation/python/django_projects/django_booking_env/local/lib/python2.7/site-packages/django/init.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/richard/programmation/python/django_projects/django_booking_env/local/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/home/richard/programmation/python/django_projects/django_booking_env/local/lib/python2.7/site-packages/django/apps/config.py", line 199, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
File "/home/richard/programmation/python/django_projects/django_booking_env/local/lib/python2.7/site-packages/booking/models.py", line 14, in
class BookingStatus(TranslationModelMixin, TranslatableModel):
File "/home/richard/programmation/python/django_projects/django_booking_env/local/lib/python2.7/site-packages/django/db/models/base.py", line 309, in new
new_class._prepare()
File "/home/richard/programmation/python/django_projects/django_booking_env/local/lib/python2.7/site-packages/django/db/models/base.py", line 359, in _prepare
signals.class_prepared.send(sender=cls)
File "/home/richard/programmation/python/django_projects/django_booking_env/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 191, in send
response = receiver(signal=self, sender=sender, **named)
File "/home/richard/programmation/python/django_projects/django_booking_env/local/lib/python2.7/site-packages/hvad/models.py", line 477, in prepare_translatable_model
model.add_to_class('_base_manager', Manager())
File "/home/richard/programmation/python/django_projects/django_booking_env/local/lib/python2.7/site-packages/django/db/models/base.py", line 316, in add_to_class
value.contribute_to_class(cls, name)
File "/home/richard/programmation/python/django_projects/django_booking_env/local/lib/python2.7/site-packages/django/db/models/manager.py", line 120, in contribute_to_class
setattr(model, name, ManagerDescriptor(self))
AttributeError: can't set attribute

Here is the "pip list":

certifi (2016.8.8)
cffi (1.7.0)
cryptography (1.4)
Django (1.10)
django-booking (0.7.2)
django-countries (3.4.1)
django-hvad (1.5.1)
django-libs (1.67.5)
enum34 (1.1.6)
idna (2.1)
ipaddress (1.0.16)
ndg-httpsclient (0.4.2)
pip (8.1.2)
pyasn1 (0.1.9)
pycparser (2.14)
pyOpenSSL (16.0.0)
setuptools (18.2)
six (1.10.0)
urllib3 (1.16)
wheel (0.24.0)

Thanks for your help.

TypeError at /admin/booking/booking/, when I try to view bookings from admin site

variable Value
allow_tags False
attr None
boolean False
cl django.contrib.admin.views.main.ChangeList object at 0x7f9ec0a7c090
empty_value_display '-'
f django.db.models.fields.related.ForeignKey: booking_status
field_index 2
field_name 'booking_status'
field_val Error in formatting: TypeError: coercing to Unicode: need string or buffer, NoneType found
first False
form None
link_in_col function link_in_col at 0x7f9ec0b33410
link_or_text /admin/booking/booking/1/change/
pk u'id'
result Booking: #1 (2016-08-22 16:46:16.259576+00:00)
result_repr Error in formatting: TypeError: coercing to Unicode: need string or buffer, NoneType found
row_class u' class="field-creation_date nowrap"'
row_classes [u'field-booking_status', u'nowrap']
table_tag u'th'
url u'/admin/booking/booking/1/change/'
value Error in formatting: TypeError: coercing to Unicode: need string or buffer, NoneType found

I tried to copy the local variables here that I think are causing this error.

international

in models:

from international.models import countries

...where is international coming from? (I installed using pip, got 0.7)

Problem with migration

$ ./manage.py migrate booking
Operations to perform:
Apply all migrations: booking
Running migrations:
Applying booking.0002_auto_20170308_2327...Traceback (most recent call last):
File "./manage.py", line 22, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 367, in execute_from_command_line
utility.execute()
...
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py", line 337, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such table: booking_bookingstatus_translation

migration doesn't work

following how-to in readme and when running migration, it resulted in error:

File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "c:\github.com\django-booking\booking\models.py", line 14, in <module> class BookingStatus(TranslationModelMixin, TranslatableModel):
File "c:\github.com\django\django\db\models\base.py", line 309, in __new__ new_class._prepare()
File "c:\github.com\django\django\db\models\base.py", line 359, in _prepare signals.class_prepared.send(sender=cls)
File "c:\github.com\django\django\dispatch\dispatcher.py", line 191, in send response = receiver(signal=self, sender=sender, **named)
File "C:\Users\kojdjak\PyCharmVirtualEnvs\djngFromSources\lib\site-packages\hvad\models.py", line 477, in prepare_translatable_model model.add_to_class('_base_manager', Manager())
File "c:\github.com\django\django\db\models\base.py", line 316, in add_to_class value.contribute_to_class(cls, name)
File "c:\github.com\django\django\db\models\manager.py", line 120, in contribute_to_class setattr(model, name, ManagerDescriptor(self)) 
AttributeError: can't set attribute

Missing base.html

So you release a project on GH and don't include the base.html? Nice.

Can this be used for Slot Booking?

Hello
Is there any documentation or examples given on how it can be used for slot booking ?
I am new to this and need to learn this to implement the slot booking in my django project

Does this work with Django 1.8.2

Wonder if this has succesfully worked with Django 1.8.2 and if there are any issues regarding the code implementation and/or dependencies.

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.