Repository: bitlabstudio/django-booking
Branch: master
Commit: 7bb5fdddb28b
Files: 50
Total size: 150.7 KB
Directory structure:
gitextract_cau12x4p/
├── .gitignore
├── .travis.yml
├── AUTHORS
├── CHANGELOG.txt
├── DESCRIPTION
├── LICENSE
├── MANIFEST.in
├── README.rst
├── booking/
│ ├── __init__.py
│ ├── admin.py
│ ├── auth_backends.py
│ ├── forms.py
│ ├── migrations/
│ │ ├── 0001_initial.py
│ │ └── __init__.py
│ ├── models.py
│ ├── south_migrations/
│ │ ├── 0001_initial.py
│ │ ├── 0002_auto__chg_field_booking_booking_status.py
│ │ ├── 0003_auto__add_field_booking_time_period__add_field_booking_time_unit.py
│ │ ├── 0004_auto__add_field_bookingitem_subtotal__add_field_booking_total__add_fie.py
│ │ ├── 0005_auto__add_bookingerror.py
│ │ ├── 0006_rename_bookingstatustranslation.py
│ │ ├── 0007_auto__add_bookingstatustranslation__add_unique_bookingstatustranslatio.py
│ │ ├── 0008_move_data_from_old_model_to_hvad.py
│ │ ├── 0009_auto__del_bookingstatustranslationrenamed.py
│ │ ├── 0010_auto__chg_field_bookingitem_subtotal__chg_field_booking_total.py
│ │ └── __init__.py
│ ├── templates/
│ │ └── booking/
│ │ ├── booking_detail.html
│ │ ├── booking_form.html
│ │ └── booking_list.html
│ ├── tests/
│ │ ├── __init__.py
│ │ ├── forms_tests.py
│ │ ├── models_tests.py
│ │ ├── settings.py
│ │ ├── test_app/
│ │ │ ├── __init__.py
│ │ │ ├── models.py
│ │ │ └── templates/
│ │ │ ├── 400.html
│ │ │ ├── 500.html
│ │ │ └── base.html
│ │ ├── test_settings.py
│ │ ├── urls.py
│ │ └── views_tests.py
│ ├── urls.py
│ ├── utils.py
│ └── views.py
├── manage.py
├── requirements.txt
├── runtests.py
├── setup.py
├── test_requirements.txt
└── tox.ini
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
*.egg-info/
*.pyc
*coverage/
db.sqlite
dist/
docs/_build/
app_media/
app_static/
.coverage
*.tox/
================================================
FILE: .travis.yml
================================================
language: python
python:
- "2.7"
install: pip install -r test_requirements.txt --use-mirrors
script: python booking/tests/runtests.py
================================================
FILE: AUTHORS
================================================
Current or previous core committers
Daniel Kaufhold
Contributors (in alphabetical order)
* Tobias Lorenz
* Your name could stand here :)
================================================
FILE: CHANGELOG.txt
================================================
=== (ongoing 0.7.X) To be released as 0.8 ===
- Prepared app for Django 1.9 and Python 3.5
- Fixed dependencies
- Fixed compatibility of django.conf.urls.defaults import
=== 0.7 ===
- added property for full price of an item
- lowered decimal places of price to 2
=== 0.6 ===
- Migrated to django-hvad
=== 0.5 ===
- updated to factory-boy > 2.0.0
=== 0.4 ===
- Added the BookingError model
=== 0.3 ===
- Added email to Booking admin list display fields
- Added utils for get_booking and persist_booking
=== 0.2 ===
- Added BookingIDBackend and BookingIDAuthenticationForm
- updated gender choices to Mr and Mrs
- Added total, subtotal and currency field
- Added time_period and time_unit field to Booking model
== 0.1 ===
- Initial commit
================================================
FILE: DESCRIPTION
================================================
A reusable Django app that manages bookings for various purposes.
================================================
FILE: LICENSE
================================================
The MIT License (MIT)
Copyright (c) 2013 Daniel Kaufhold
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: MANIFEST.in
================================================
include AUTHORS
include LICENSE
include DESCRIPTION
include CHANGELOG.txt
include README.md
graft booking
global-exclude *.orig *.pyc *.log *.swp
prune booking/tests/coverage
prune booking/.ropeproject
================================================
FILE: README.rst
================================================
Django Booking
==============
A reusable Django app that manages bookings for various purposes.
Installation
------------
To get the latest stable release from PyPi
.. code-block:: bash
$ pip install django-booking
To get the latest commit from GitHub
.. code-block:: bash
$ 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``
.. code-block:: python
INSTALLED_APPS = (
...,
'booking',
)
Add the ``booking`` URLs to your ``urls.py``
.. code-block:: python
urlpatterns = patterns('',
...
url(r'^booking/', include('booking.urls')),
)
Don't forget to migrate your database
.. code-block:: bash
./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
.. code-block:: bash
# 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.
================================================
FILE: booking/__init__.py
================================================
# -*- coding: utf-8 -*-
__version__ = '0.7.2'
================================================
FILE: booking/admin.py
================================================
"""Admin classes for the booking app."""
from django.contrib import admin
from hvad.admin import TranslatableAdmin
from . import models
class BookingAdmin(admin.ModelAdmin):
list_display = [
'creation_date', 'booking_status', 'booking_id', 'user', 'email',
'session', 'date_from', 'date_until',
]
class BookingItemAdmin(admin.ModelAdmin):
list_display = ['booking', 'booked_item', 'quantity', 'persons']
admin.site.register(models.Booking, BookingAdmin)
admin.site.register(models.BookingError)
admin.site.register(models.BookingItem, BookingItemAdmin)
admin.site.register(models.BookingStatus, TranslatableAdmin)
admin.site.register(models.ExtraPersonInfo)
================================================
FILE: booking/auth_backends.py
================================================
"""Custom authentication backends for the booking app."""
from django.contrib.auth.backends import ModelBackend
from .models import Booking
class BookingIDBackend(ModelBackend):
"""
Custom authentication backend that allows login via email and booking ID.
"""
def authenticate(self, username=None, password=None, **kwargs):
try:
booking = Booking.objects.get(
booking_id=password, user__email=username)
except Booking.DoesNotExist:
return None
return booking.user
================================================
FILE: booking/forms.py
================================================
"""Forms for the ``booking`` app."""
from django import forms
from django.conf import settings
from django.contrib.auth import authenticate
from django.contrib.auth.forms import AuthenticationForm
from django.utils.translation import ugettext_lazy as _
from .models import Booking, BookingStatus
class BookingForm(forms.ModelForm):
def __init__(self, session=None, user=None, *args, **kwargs):
self.user = user
self.session = session
super(BookingForm, self).__init__(*args, **kwargs)
# fields that should remain blank / not required
keep_blank = [
'phone', 'notes', 'street2', 'title', 'user', 'session',
'date_from', 'date_until', 'special_request', 'time_period',
'time_unit', 'email', 'currency', 'total']
# set all fields except the keep_blank ones to be required, since they
# need to be blank=True on the model itself to allow creating Booking
# instances without data
for name, field in self.fields.items():
if name not in keep_blank:
self.fields[name].required = True
def save(self, *args, **kwargs):
if not self.instance.pk:
self.instance.user = self.user
self.instance.session = self.session
status_object, created = BookingStatus.objects.get_or_create(
slug=getattr(settings, 'BOOKING_STATUS_CREATED', 'pending'))
self.instance.booking_status = status_object
return super(BookingForm, self).save(*args, **kwargs)
class Meta:
model = Booking
fields = ('gender', 'title', 'forename', 'surname', 'nationality',
'street1', 'street2', 'city', 'zip_code', 'country', 'phone',
'special_request', 'date_from', 'date_until')
class BookingIDAuthenticationForm(AuthenticationForm):
def __init__(self, *args, **kwargs):
super(BookingIDAuthenticationForm, self).__init__(*args, **kwargs)
self.fields['username'] = forms.CharField(
label=_("Email"), max_length=256)
self.fields['password'] = forms.CharField(
label=_("Booking ID"), max_length=100)
def clean_username(self):
"""Prevent case-sensitive erros in email/username."""
return self.cleaned_data['username'].lower()
def clean(self):
email = self.cleaned_data.get('username')
booking_id = self.cleaned_data.get('password')
if email and booking_id:
self.user_cache = authenticate(username=email,
password=booking_id)
if self.user_cache is None:
raise forms.ValidationError(_(
'We cannot find a valid booking ID for this email'
' address.')
)
elif not self.user_cache.is_active:
raise forms.ValidationError(self.error_messages['inactive'])
self.check_for_test_cookie()
return self.cleaned_data
================================================
FILE: booking/migrations/0001_initial.py
================================================
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-18 15:40
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django_countries.fields
import django_libs.models_mixins
class Migration(migrations.Migration):
initial = True
dependencies = [
('sessions', '0001_initial'),
('contenttypes', '0002_remove_content_type_name'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Booking',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('gender', models.CharField(blank=True, choices=[(b'mrs', 'Mrs'), (b'mr', 'Mr')], max_length=10, verbose_name='Gender')),
('title', models.CharField(blank=True, choices=[(b'dr', 'Dr.'), (b'prof', 'Prof.')], max_length=10, verbose_name='Title')),
('forename', models.CharField(blank=True, max_length=20, verbose_name='First name')),
('surname', models.CharField(blank=True, max_length=20, verbose_name='Last name')),
('nationality', django_countries.fields.CountryField(blank=True, max_length=2, verbose_name='Nationality')),
('street1', models.CharField(blank=True, max_length=256, verbose_name='Street 1')),
('street2', models.CharField(blank=True, max_length=256, verbose_name='Street 2')),
('city', models.CharField(blank=True, max_length=256, verbose_name='City')),
('zip_code', models.CharField(blank=True, max_length=256, verbose_name='ZIP/Postal code')),
('country', django_countries.fields.CountryField(blank=True, max_length=2, verbose_name='Country')),
('email', models.EmailField(blank=True, max_length=254, verbose_name='Email')),
('phone', models.CharField(blank=True, max_length=256, verbose_name='Phone')),
('special_request', models.TextField(blank=True, max_length=1024, verbose_name='Special request')),
('date_from', models.DateTimeField(blank=True, null=True, verbose_name='From')),
('date_until', models.DateTimeField(blank=True, null=True, verbose_name='Until')),
('creation_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation date')),
('booking_id', models.CharField(blank=True, max_length=100, verbose_name='Booking ID')),
('notes', models.TextField(blank=True, max_length=1024, verbose_name=b'Notes')),
('time_period', models.PositiveIntegerField(blank=True, null=True, verbose_name='Time period')),
('time_unit', models.CharField(blank=True, default=b'', max_length=64, verbose_name='Time unit')),
('total', models.DecimalField(blank=True, decimal_places=2, max_digits=36, null=True, verbose_name='Total')),
('currency', models.CharField(blank=True, max_length=128, verbose_name='Currency')),
],
options={
'ordering': ['-creation_date'],
},
),
migrations.CreateModel(
name='BookingError',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('message', models.CharField(blank=True, max_length=1000, verbose_name='Message')),
('details', models.TextField(blank=True, max_length=4000, verbose_name='Details')),
('date', models.DateTimeField(auto_now_add=True, verbose_name='Date')),
('booking', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='booking.Booking', verbose_name='Booking')),
],
),
migrations.CreateModel(
name='BookingItem',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('quantity', models.PositiveIntegerField(default=1, verbose_name='Quantity')),
('persons', models.PositiveIntegerField(blank=True, null=True, verbose_name='Persons')),
('subtotal', models.DecimalField(blank=True, decimal_places=2, max_digits=36, null=True, verbose_name='Subtotal')),
('object_id', models.PositiveIntegerField()),
('booking', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='booking.Booking', verbose_name='Booking')),
('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
],
options={
'ordering': ['-booking__creation_date'],
},
),
migrations.CreateModel(
name='BookingStatus',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('slug', models.SlugField(verbose_name='Slug')),
],
options={
'abstract': False,
},
bases=(django_libs.models_mixins.TranslationModelMixin, models.Model),
),
migrations.CreateModel(
name='BookingStatusTranslation',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=128, verbose_name='Name')),
('language_code', models.CharField(db_index=True, max_length=15)),
('master', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='booking.BookingStatus')),
],
options={
'managed': True,
'abstract': False,
'db_table': 'booking_bookingstatus_translation',
'db_tablespace': '',
'default_permissions': (),
},
),
migrations.CreateModel(
name='ExtraPersonInfo',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('forename', models.CharField(max_length=20, verbose_name='First name')),
('surname', models.CharField(max_length=20, verbose_name='Last name')),
('arrival', models.DateTimeField(blank=True, null=True, verbose_name='Arrival')),
('message', models.TextField(blank=True, max_length=1024, verbose_name='Message')),
('booking', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='booking.Booking', verbose_name='Booking')),
],
options={
'ordering': ['-booking__creation_date'],
},
),
migrations.AddField(
model_name='booking',
name='booking_status',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='booking.BookingStatus', verbose_name=b'Booking status'),
),
migrations.AddField(
model_name='booking',
name='session',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='sessions.Session', verbose_name='Session'),
),
migrations.AddField(
model_name='booking',
name='user',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='bookings', to=settings.AUTH_USER_MODEL, verbose_name='User'),
),
migrations.AlterUniqueTogether(
name='bookingstatustranslation',
unique_together=set([('language_code', 'master')]),
),
]
================================================
FILE: booking/migrations/__init__.py
================================================
================================================
FILE: booking/models.py
================================================
"""Models for the ``booking`` app."""
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from django_libs.models_mixins import TranslationModelMixin
from django_countries.fields import CountryField
from hvad.models import TranslatableModel, TranslatedFields
class BookingStatus(TranslationModelMixin, TranslatableModel):
"""
Master data containing all booking status.
For translatable fields check ``BookingStatusTranslation``.
:slug: A unique slug identifier.
translated:
:name: The displayable name for the status.
"""
slug = models.SlugField(
verbose_name=_('Slug'),
)
translations = TranslatedFields(
name=models.CharField(
verbose_name=_('Name'),
max_length=128,
)
)
@python_2_unicode_compatible
class Booking(models.Model):
"""
Model to contain information about a booking.
Note, that on the model itself, most of the attributes are blank=True.
We need this behaviour to be able to create empty temporary bookings.
You will have to take care of the field being required or not in a
ModelForm yourself.
:user (optional): Connection to Django's User model.
:session (optional): Stored session to identify anonymous users.
:gender (optional): Gender of the user.
:title (optional): Title of the user.
:forename (optional): First name of the user.
:surname (optional): Last name of the user.
:nationality (optional): The nationality of the user.
:street1 (optional): Street address of the user.
:street2 (optional): Additional street address of the user.
:city (optional): City of the user's address.
:zip_code (optional): ZIP of the user's address.
:country (optional): Country of the user's address.
:phone (optional): Phone number of the user.
:email: Email of the user.
:special_request (optional): A special request of the customer.
:date_from (optional): From when the booking is active.
:date_until (optional): Until when the booking is active.
:time_period (optional): How long the period from date_from will be.
e.g.: 10 (days).
:time_unit (optional): What unit of time the period is of. e.g. nights or
days.
:creation_date: Date of the booking.
:booking_id (optional): Custom unique booking identifier.
:booking_status: Current status of the booking.
:notes (optional): Staff notes.
:total (optional): Field for storing a total of all items.
:currency (optional): If total is uses, we usually also need a currency.
"""
user = models.ForeignKey(
'auth.User',
verbose_name=_('User'),
related_name='bookings',
blank=True, null=True,
)
session = models.ForeignKey(
'sessions.Session',
verbose_name=_('Session'),
blank=True, null=True,
)
gender = models.CharField(
max_length=10,
verbose_name=_('Gender'),
choices=(
('mrs', _('Mrs')),
('mr', _('Mr')),
),
blank=True,
)
title = models.CharField(
max_length=10,
verbose_name=_('Title'),
choices=(
('dr', _('Dr.')),
('prof', _('Prof.')),
),
blank=True,
)
forename = models.CharField(
verbose_name=_('First name'),
max_length=20,
blank=True,
)
surname = models.CharField(
verbose_name=_('Last name'),
max_length=20,
blank=True,
)
nationality = CountryField(
max_length=2,
verbose_name=_('Nationality'),
blank=True,
)
street1 = models.CharField(
verbose_name=_('Street 1'),
max_length=256,
blank=True,
)
street2 = models.CharField(
verbose_name=_('Street 2'),
max_length=256,
blank=True,
)
city = models.CharField(
verbose_name=_('City'),
max_length=256,
blank=True,
)
zip_code = models.CharField(
verbose_name=_('ZIP/Postal code'),
max_length=256,
blank=True,
)
country = CountryField(
max_length=2,
verbose_name=_('Country'),
blank=True,
)
email = models.EmailField(
verbose_name=_('Email'),
blank=True,
)
phone = models.CharField(
verbose_name=_('Phone'),
max_length=256,
blank=True,
)
special_request = models.TextField(
max_length=1024,
verbose_name=_('Special request'),
blank=True,
)
date_from = models.DateTimeField(
verbose_name=_('From'),
blank=True, null=True,
)
date_until = models.DateTimeField(
verbose_name=_('Until'),
blank=True, null=True,
)
creation_date = models.DateTimeField(
verbose_name=_('Creation date'),
auto_now_add=True,
)
booking_id = models.CharField(
max_length=100,
verbose_name=_('Booking ID'),
blank=True,
)
booking_status = models.ForeignKey(
'booking.BookingStatus',
verbose_name=('Booking status'),
blank=True, null=True,
)
notes = models.TextField(
max_length=1024,
verbose_name=('Notes'),
blank=True,
)
time_period = models.PositiveIntegerField(
verbose_name=_('Time period'),
blank=True, null=True,
)
time_unit = models.CharField(
verbose_name=_('Time unit'),
default=getattr(settings, 'BOOKING_TIME_INTERVAL', ''),
max_length=64,
blank=True,
)
total = models.DecimalField(
max_digits=36,
decimal_places=2,
verbose_name=_('Total'),
blank=True, null=True,
)
currency = models.CharField(
verbose_name=_('Currency'),
max_length=128,
blank=True,
)
class Meta:
ordering = ['-creation_date']
def __str__(self):
return '#{} ({})'.format(self.booking_id or self.pk,
self.creation_date)
@python_2_unicode_compatible
class BookingError(models.Model):
"""
Holds information about an error during a booking process.
This can be particularly useful, when many of the processes are automated
or reliant on a third party app or API. You then can store the returned
values directly into this model and have easy access and reference to the
actual booking.
:booking: The booking during this error occurred.
:message: The short error message, that you need to store.
:details: A more in depth text about the error or any kind of additional
information, e.g. a traceback.
:date: The time and date this error occured.
"""
booking = models.ForeignKey(
Booking,
verbose_name=_('Booking'),
)
message = models.CharField(
verbose_name=_('Message'),
max_length=1000,
blank=True,
)
details = models.TextField(
verbose_name=_('Details'),
max_length=4000,
blank=True,
)
date = models.DateTimeField(
verbose_name=_('Date'),
auto_now_add=True,
)
def __str__(self):
return u'[{0}] {1} - {2}'.format(self.date, self.booking.booking_id,
self.message)
@python_2_unicode_compatible
class BookingItem(models.Model):
"""
Model to connect a booking with a related object.
:quantity: Quantity of booked items.
:persons (optional): Quantity of persons, who are involved in this booking.
:subtotal (optional): Field for storing the price of each individual item.
:booked_item: Connection to related booked item.
:booking: Connection to related booking.
properties:
:price: Returns the full price for subtotal * quantity.
"""
quantity = models.PositiveIntegerField(
default=1,
verbose_name=_('Quantity'),
)
persons = models.PositiveIntegerField(
verbose_name=_('Persons'),
blank=True, null=True,
)
subtotal = models.DecimalField(
max_digits=36,
decimal_places=2,
verbose_name=_('Subtotal'),
blank=True, null=True,
)
# GFK 'booked_item'
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
booked_item = GenericForeignKey('content_type', 'object_id')
booking = models.ForeignKey(
'booking.Booking',
verbose_name=_('Booking'),
)
class Meta:
ordering = ['-booking__creation_date']
def __str__(self):
return u'{} ({})'.format(self.booking, self.booked_item)
@property
def price(self):
return self.quantity * self.subtotal
@python_2_unicode_compatible
class ExtraPersonInfo(models.Model):
"""
Model to add extra information of persons/guests to a booking.
:forename: First name of the user.
:surname: Last name of the user.
:arrival: Arrival date of the guest.
:booking: Connection to related booking.
:message: An additional message regarding this person.
"""
forename = models.CharField(
verbose_name=_('First name'),
max_length=20,
)
surname = models.CharField(
verbose_name=_('Last name'),
max_length=20,
)
arrival = models.DateTimeField(
verbose_name=_('Arrival'),
blank=True, null=True,
)
booking = models.ForeignKey(
'booking.Booking',
verbose_name=_('Booking'),
)
message = models.TextField(
max_length=1024,
verbose_name=_('Message'),
blank=True,
)
class Meta:
ordering = ['-booking__creation_date']
def __str__(self):
return u'{} {} ({})'.format(self.forename, self.surname, self.booking)
================================================
FILE: booking/south_migrations/0001_initial.py
================================================
# flake8: noqa
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'BookingStatus'
db.create_table(u'booking_bookingstatus', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('slug', self.gf('django.db.models.fields.SlugField')(max_length=50)),
))
db.send_create_signal(u'booking', ['BookingStatus'])
# Adding model 'BookingStatusTranslation'
db.create_table(u'booking_bookingstatustranslation', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('name', self.gf('django.db.models.fields.CharField')(max_length=128)),
('language', self.gf('django.db.models.fields.CharField')(max_length=16)),
('status', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['booking.BookingStatus'])),
))
db.send_create_signal(u'booking', ['BookingStatusTranslation'])
# Adding model 'Booking'
db.create_table(u'booking_booking', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('user', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='bookings', null=True, to=orm['auth.User'])),
('session', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['sessions.Session'], null=True, blank=True)),
('gender', self.gf('django.db.models.fields.CharField')(max_length=10)),
('title', self.gf('django.db.models.fields.CharField')(max_length=10, blank=True)),
('forename', self.gf('django.db.models.fields.CharField')(max_length=20)),
('surname', self.gf('django.db.models.fields.CharField')(max_length=20)),
('nationality', self.gf('django.db.models.fields.CharField')(max_length=2)),
('street1', self.gf('django.db.models.fields.CharField')(max_length=256)),
('street2', self.gf('django.db.models.fields.CharField')(max_length=256, blank=True)),
('city', self.gf('django.db.models.fields.CharField')(max_length=256)),
('zip_code', self.gf('django.db.models.fields.CharField')(max_length=256)),
('country', self.gf('django.db.models.fields.CharField')(max_length=2)),
('email', self.gf('django.db.models.fields.EmailField')(max_length=75)),
('phone', self.gf('django.db.models.fields.CharField')(max_length=256, blank=True)),
('special_request', self.gf('django.db.models.fields.TextField')(max_length=1024, blank=True)),
('date_from', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
('date_until', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
('creation_date', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('booking_id', self.gf('django.db.models.fields.CharField')(max_length=100, blank=True)),
('booking_status', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['booking.BookingStatus'])),
('notes', self.gf('django.db.models.fields.TextField')(max_length=1024, blank=True)),
))
db.send_create_signal(u'booking', ['Booking'])
# Adding model 'BookingItem'
db.create_table(u'booking_bookingitem', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('quantity', self.gf('django.db.models.fields.PositiveIntegerField')(default=1)),
('persons', self.gf('django.db.models.fields.PositiveIntegerField')(null=True, blank=True)),
('content_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contenttypes.ContentType'])),
('object_id', self.gf('django.db.models.fields.PositiveIntegerField')()),
('booking', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['booking.Booking'])),
))
db.send_create_signal(u'booking', ['BookingItem'])
# Adding model 'ExtraPersonInfo'
db.create_table(u'booking_extrapersoninfo', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('forename', self.gf('django.db.models.fields.CharField')(max_length=20)),
('surname', self.gf('django.db.models.fields.CharField')(max_length=20)),
('arrival', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
('booking', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['booking.Booking'])),
('message', self.gf('django.db.models.fields.TextField')(max_length=1024, blank=True)),
))
db.send_create_signal(u'booking', ['ExtraPersonInfo'])
def backwards(self, orm):
# Deleting model 'BookingStatus'
db.delete_table(u'booking_bookingstatus')
# Deleting model 'BookingStatusTranslation'
db.delete_table(u'booking_bookingstatustranslation')
# Deleting model 'Booking'
db.delete_table(u'booking_booking')
# Deleting model 'BookingItem'
db.delete_table(u'booking_bookingitem')
# Deleting model 'ExtraPersonInfo'
db.delete_table(u'booking_extrapersoninfo')
models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
u'booking.booking': {
'Meta': {'ordering': "['-creation_date']", 'object_name': 'Booking'},
'booking_id': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
'booking_status': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.BookingStatus']"}),
'city': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
'country': ('django.db.models.fields.CharField', [], {'max_length': '2'}),
'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'date_from': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'date_until': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
'forename': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
'gender': ('django.db.models.fields.CharField', [], {'max_length': '10'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'nationality': ('django.db.models.fields.CharField', [], {'max_length': '2'}),
'notes': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'phone': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'session': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['sessions.Session']", 'null': 'True', 'blank': 'True'}),
'special_request': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'street1': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
'street2': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'surname': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'bookings'", 'null': 'True', 'to': u"orm['auth.User']"}),
'zip_code': ('django.db.models.fields.CharField', [], {'max_length': '256'})
},
u'booking.bookingitem': {
'Meta': {'ordering': "['-booking__creation_date']", 'object_name': 'BookingItem'},
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
'persons': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'quantity': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'})
},
u'booking.bookingstatus': {
'Meta': {'object_name': 'BookingStatus'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'})
},
u'booking.bookingstatustranslation': {
'Meta': {'object_name': 'BookingStatusTranslation'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'status': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.BookingStatus']"})
},
u'booking.extrapersoninfo': {
'Meta': {'ordering': "['-booking__creation_date']", 'object_name': 'ExtraPersonInfo'},
'arrival': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'forename': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'message': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'surname': ('django.db.models.fields.CharField', [], {'max_length': '20'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
u'sessions.session': {
'Meta': {'object_name': 'Session', 'db_table': "'django_session'"},
'expire_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'session_data': ('django.db.models.fields.TextField', [], {}),
'session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'primary_key': 'True'})
}
}
complete_apps = ['booking']
================================================
FILE: booking/south_migrations/0002_auto__chg_field_booking_booking_status.py
================================================
# flake8: noqa
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Booking.booking_status'
db.alter_column(u'booking_booking', 'booking_status_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['booking.BookingStatus'], null=True))
def backwards(self, orm):
# User chose to not deal with backwards NULL issues for 'Booking.booking_status'
raise RuntimeError("Cannot reverse this migration. 'Booking.booking_status' and its values cannot be restored.")
# The following code is provided here to aid in writing a correct migration
# Changing field 'Booking.booking_status'
db.alter_column(u'booking_booking', 'booking_status_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['booking.BookingStatus']))
models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
u'booking.booking': {
'Meta': {'ordering': "['-creation_date']", 'object_name': 'Booking'},
'booking_id': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
'booking_status': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.BookingStatus']", 'null': 'True', 'blank': 'True'}),
'city': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'country': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}),
'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'date_from': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'date_until': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'forename': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
'gender': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'nationality': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}),
'notes': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'phone': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'session': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['sessions.Session']", 'null': 'True', 'blank': 'True'}),
'special_request': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'street1': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'street2': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'surname': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'bookings'", 'null': 'True', 'to': u"orm['auth.User']"}),
'zip_code': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'})
},
u'booking.bookingitem': {
'Meta': {'ordering': "['-booking__creation_date']", 'object_name': 'BookingItem'},
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
'persons': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'quantity': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'})
},
u'booking.bookingstatus': {
'Meta': {'object_name': 'BookingStatus'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'})
},
u'booking.bookingstatustranslation': {
'Meta': {'object_name': 'BookingStatusTranslation'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'status': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.BookingStatus']"})
},
u'booking.extrapersoninfo': {
'Meta': {'ordering': "['-booking__creation_date']", 'object_name': 'ExtraPersonInfo'},
'arrival': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'forename': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'message': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'surname': ('django.db.models.fields.CharField', [], {'max_length': '20'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
u'sessions.session': {
'Meta': {'object_name': 'Session', 'db_table': "'django_session'"},
'expire_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'session_data': ('django.db.models.fields.TextField', [], {}),
'session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'primary_key': 'True'})
}
}
complete_apps = ['booking']
================================================
FILE: booking/south_migrations/0003_auto__add_field_booking_time_period__add_field_booking_time_unit.py
================================================
# flake8: noqa
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Booking.time_period'
db.add_column(u'booking_booking', 'time_period',
self.gf('django.db.models.fields.PositiveIntegerField')(null=True, blank=True),
keep_default=False)
# Adding field 'Booking.time_unit'
db.add_column(u'booking_booking', 'time_unit',
self.gf('django.db.models.fields.CharField')(default='', max_length=64, blank=True),
keep_default=False)
def backwards(self, orm):
# Deleting field 'Booking.time_period'
db.delete_column(u'booking_booking', 'time_period')
# Deleting field 'Booking.time_unit'
db.delete_column(u'booking_booking', 'time_unit')
models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
u'booking.booking': {
'Meta': {'ordering': "['-creation_date']", 'object_name': 'Booking'},
'booking_id': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
'booking_status': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.BookingStatus']", 'null': 'True', 'blank': 'True'}),
'city': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'country': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}),
'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'date_from': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'date_until': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'forename': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
'gender': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'nationality': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}),
'notes': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'phone': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'session': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['sessions.Session']", 'null': 'True', 'blank': 'True'}),
'special_request': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'street1': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'street2': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'surname': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
'time_period': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'time_unit': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64', 'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'bookings'", 'null': 'True', 'to': u"orm['auth.User']"}),
'zip_code': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'})
},
u'booking.bookingitem': {
'Meta': {'ordering': "['-booking__creation_date']", 'object_name': 'BookingItem'},
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
'persons': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'quantity': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'})
},
u'booking.bookingstatus': {
'Meta': {'object_name': 'BookingStatus'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'})
},
u'booking.bookingstatustranslation': {
'Meta': {'object_name': 'BookingStatusTranslation'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'status': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.BookingStatus']"})
},
u'booking.extrapersoninfo': {
'Meta': {'ordering': "['-booking__creation_date']", 'object_name': 'ExtraPersonInfo'},
'arrival': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'forename': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'message': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'surname': ('django.db.models.fields.CharField', [], {'max_length': '20'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
u'sessions.session': {
'Meta': {'object_name': 'Session', 'db_table': "'django_session'"},
'expire_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'session_data': ('django.db.models.fields.TextField', [], {}),
'session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'primary_key': 'True'})
}
}
complete_apps = ['booking']
================================================
FILE: booking/south_migrations/0004_auto__add_field_bookingitem_subtotal__add_field_booking_total__add_fie.py
================================================
# flake8: noqa
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'BookingItem.subtotal'
db.add_column(u'booking_bookingitem', 'subtotal',
self.gf('django.db.models.fields.DecimalField')(null=True, max_digits=36, decimal_places=28, blank=True),
keep_default=False)
# Adding field 'Booking.total'
db.add_column(u'booking_booking', 'total',
self.gf('django.db.models.fields.DecimalField')(null=True, max_digits=36, decimal_places=28, blank=True),
keep_default=False)
# Adding field 'Booking.currency'
db.add_column(u'booking_booking', 'currency',
self.gf('django.db.models.fields.CharField')(default='', max_length=128, blank=True),
keep_default=False)
def backwards(self, orm):
# Deleting field 'BookingItem.subtotal'
db.delete_column(u'booking_bookingitem', 'subtotal')
# Deleting field 'Booking.total'
db.delete_column(u'booking_booking', 'total')
# Deleting field 'Booking.currency'
db.delete_column(u'booking_booking', 'currency')
models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
u'booking.booking': {
'Meta': {'ordering': "['-creation_date']", 'object_name': 'Booking'},
'booking_id': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
'booking_status': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.BookingStatus']", 'null': 'True', 'blank': 'True'}),
'city': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'country': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}),
'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'currency': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
'date_from': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'date_until': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'forename': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
'gender': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'nationality': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}),
'notes': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'phone': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'session': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['sessions.Session']", 'null': 'True', 'blank': 'True'}),
'special_request': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'street1': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'street2': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'surname': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
'time_period': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'time_unit': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64', 'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'}),
'total': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '36', 'decimal_places': '28', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'bookings'", 'null': 'True', 'to': u"orm['auth.User']"}),
'zip_code': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'})
},
u'booking.bookingitem': {
'Meta': {'ordering': "['-booking__creation_date']", 'object_name': 'BookingItem'},
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
'persons': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'quantity': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'subtotal': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '36', 'decimal_places': '28', 'blank': 'True'})
},
u'booking.bookingstatus': {
'Meta': {'object_name': 'BookingStatus'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'})
},
u'booking.bookingstatustranslation': {
'Meta': {'object_name': 'BookingStatusTranslation'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'status': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.BookingStatus']"})
},
u'booking.extrapersoninfo': {
'Meta': {'ordering': "['-booking__creation_date']", 'object_name': 'ExtraPersonInfo'},
'arrival': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'forename': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'message': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'surname': ('django.db.models.fields.CharField', [], {'max_length': '20'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
u'sessions.session': {
'Meta': {'object_name': 'Session', 'db_table': "'django_session'"},
'expire_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'session_data': ('django.db.models.fields.TextField', [], {}),
'session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'primary_key': 'True'})
}
}
complete_apps = ['booking']
================================================
FILE: booking/south_migrations/0005_auto__add_bookingerror.py
================================================
# flake8: noqa
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'BookingError'
db.create_table(u'booking_bookingerror', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('booking', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['booking.Booking'])),
('message', self.gf('django.db.models.fields.CharField')(max_length=1000, blank=True)),
('details', self.gf('django.db.models.fields.TextField')(max_length=4000, blank=True)),
('date', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
))
db.send_create_signal(u'booking', ['BookingError'])
def backwards(self, orm):
# Deleting model 'BookingError'
db.delete_table(u'booking_bookingerror')
models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
u'booking.booking': {
'Meta': {'ordering': "['-creation_date']", 'object_name': 'Booking'},
'booking_id': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
'booking_status': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.BookingStatus']", 'null': 'True', 'blank': 'True'}),
'city': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'country': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}),
'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'currency': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
'date_from': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'date_until': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'forename': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
'gender': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'nationality': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}),
'notes': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'phone': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'session': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['sessions.Session']", 'null': 'True', 'blank': 'True'}),
'special_request': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'street1': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'street2': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'surname': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
'time_period': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'time_unit': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64', 'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'}),
'total': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '36', 'decimal_places': '28', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'bookings'", 'null': 'True', 'to': u"orm['auth.User']"}),
'zip_code': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'})
},
u'booking.bookingerror': {
'Meta': {'object_name': 'BookingError'},
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'details': ('django.db.models.fields.TextField', [], {'max_length': '4000', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'message': ('django.db.models.fields.CharField', [], {'max_length': '1000', 'blank': 'True'})
},
u'booking.bookingitem': {
'Meta': {'ordering': "['-booking__creation_date']", 'object_name': 'BookingItem'},
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
'persons': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'quantity': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'subtotal': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '36', 'decimal_places': '28', 'blank': 'True'})
},
u'booking.bookingstatus': {
'Meta': {'object_name': 'BookingStatus'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'})
},
u'booking.bookingstatustranslation': {
'Meta': {'object_name': 'BookingStatusTranslation'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'status': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.BookingStatus']"})
},
u'booking.extrapersoninfo': {
'Meta': {'ordering': "['-booking__creation_date']", 'object_name': 'ExtraPersonInfo'},
'arrival': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'forename': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'message': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'surname': ('django.db.models.fields.CharField', [], {'max_length': '20'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
u'sessions.session': {
'Meta': {'object_name': 'Session', 'db_table': "'django_session'"},
'expire_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'session_data': ('django.db.models.fields.TextField', [], {}),
'session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'primary_key': 'True'})
}
}
complete_apps = ['booking']
================================================
FILE: booking/south_migrations/0006_rename_bookingstatustranslation.py
================================================
# flake8: noqa
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
db.rename_table(u'booking_bookingstatustranslation', u'booking_bookingstatustranslationrenamed')
def backwards(self, orm):
db.rename_table(u'booking_bookingstatustranslationrenamed', u'booking_bookingstatustranslation')
models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
u'booking.booking': {
'Meta': {'ordering': "['-creation_date']", 'object_name': 'Booking'},
'booking_id': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
'booking_status': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.BookingStatus']", 'null': 'True', 'blank': 'True'}),
'city': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'country': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}),
'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'currency': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
'date_from': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'date_until': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'forename': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
'gender': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'nationality': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}),
'notes': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'phone': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'session': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['sessions.Session']", 'null': 'True', 'blank': 'True'}),
'special_request': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'street1': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'street2': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'surname': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
'time_period': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'time_unit': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64', 'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'}),
'total': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '36', 'decimal_places': '28', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'bookings'", 'null': 'True', 'to': u"orm['auth.User']"}),
'zip_code': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'})
},
u'booking.bookingerror': {
'Meta': {'object_name': 'BookingError'},
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'details': ('django.db.models.fields.TextField', [], {'max_length': '4000', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'message': ('django.db.models.fields.CharField', [], {'max_length': '1000', 'blank': 'True'})
},
u'booking.bookingitem': {
'Meta': {'ordering': "['-booking__creation_date']", 'object_name': 'BookingItem'},
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
'persons': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'quantity': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'subtotal': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '36', 'decimal_places': '28', 'blank': 'True'})
},
u'booking.bookingstatus': {
'Meta': {'object_name': 'BookingStatus'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'})
},
u'booking.bookingstatustranslationrenamed': {
'Meta': {'object_name': 'BookingStatusTranslationRenamed'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'status': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.BookingStatus']"})
},
u'booking.extrapersoninfo': {
'Meta': {'ordering': "['-booking__creation_date']", 'object_name': 'ExtraPersonInfo'},
'arrival': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'forename': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'message': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'surname': ('django.db.models.fields.CharField', [], {'max_length': '20'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
u'sessions.session': {
'Meta': {'object_name': 'Session', 'db_table': "'django_session'"},
'expire_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'session_data': ('django.db.models.fields.TextField', [], {}),
'session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'primary_key': 'True'})
}
}
complete_apps = ['booking']
================================================
FILE: booking/south_migrations/0007_auto__add_bookingstatustranslation__add_unique_bookingstatustranslatio.py
================================================
# flake8: noqa
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'BookingStatusTranslation'
db.create_table(u'booking_bookingstatus_translation', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('name', self.gf('django.db.models.fields.CharField')(max_length=128)),
('language_code', self.gf('django.db.models.fields.CharField')(max_length=15, db_index=True)),
('master', self.gf('django.db.models.fields.related.ForeignKey')(related_name='translations', null=True, to=orm['booking.BookingStatus'])),
))
db.send_create_signal(u'booking', ['BookingStatusTranslation'])
# Adding unique constraint on 'BookingStatusTranslation', fields ['language_code', 'master']
db.create_unique(u'booking_bookingstatus_translation', ['language_code', 'master_id'])
def backwards(self, orm):
# Removing unique constraint on 'BookingStatusTranslation', fields ['language_code', 'master']
db.delete_unique(u'booking_bookingstatus_translation', ['language_code', 'master_id'])
# Deleting model 'BookingStatusTranslation'
db.delete_table(u'booking_bookingstatus_translation')
models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
u'booking.booking': {
'Meta': {'ordering': "['-creation_date']", 'object_name': 'Booking'},
'booking_id': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
'booking_status': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.BookingStatus']", 'null': 'True', 'blank': 'True'}),
'city': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'country': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}),
'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'currency': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
'date_from': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'date_until': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'forename': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
'gender': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'nationality': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}),
'notes': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'phone': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'session': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['sessions.Session']", 'null': 'True', 'blank': 'True'}),
'special_request': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'street1': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'street2': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'surname': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
'time_period': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'time_unit': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64', 'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'}),
'total': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '36', 'decimal_places': '28', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'bookings'", 'null': 'True', 'to': u"orm['auth.User']"}),
'zip_code': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'})
},
u'booking.bookingerror': {
'Meta': {'object_name': 'BookingError'},
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'details': ('django.db.models.fields.TextField', [], {'max_length': '4000', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'message': ('django.db.models.fields.CharField', [], {'max_length': '1000', 'blank': 'True'})
},
u'booking.bookingitem': {
'Meta': {'ordering': "['-booking__creation_date']", 'object_name': 'BookingItem'},
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
'persons': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'quantity': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'subtotal': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '36', 'decimal_places': '28', 'blank': 'True'})
},
u'booking.bookingstatus': {
'Meta': {'object_name': 'BookingStatus'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'})
},
u'booking.bookingstatustranslation': {
'Meta': {'unique_together': "[('language_code', 'master')]", 'object_name': 'BookingStatusTranslation', 'db_table': "u'booking_bookingstatus_translation'"},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language_code': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}),
'master': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'translations'", 'null': 'True', 'to': u"orm['booking.BookingStatus']"}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'})
},
u'booking.bookingstatustranslationrenamed': {
'Meta': {'object_name': 'BookingStatusTranslationRenamed'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'status': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.BookingStatus']"})
},
u'booking.extrapersoninfo': {
'Meta': {'ordering': "['-booking__creation_date']", 'object_name': 'ExtraPersonInfo'},
'arrival': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'forename': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'message': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'surname': ('django.db.models.fields.CharField', [], {'max_length': '20'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
u'sessions.session': {
'Meta': {'object_name': 'Session', 'db_table': "'django_session'"},
'expire_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'session_data': ('django.db.models.fields.TextField', [], {}),
'session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'primary_key': 'True'})
}
}
complete_apps = ['booking']
================================================
FILE: booking/south_migrations/0008_move_data_from_old_model_to_hvad.py
================================================
# flake8: noqa
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
# for every status
for status in orm['booking.BookingStatus'].objects.all():
# iterate over the old renamed translation instances
for statustrans_old in orm['booking.BookingStatusTranslationRenamed'].objects.filter(status=status):
orm['booking.BookingStatusTranslation'].objects.create(
name=statustrans_old.name,
language_code=statustrans_old.language,
master=status,
)
def backwards(self, orm):
"Write your backwards methods here."
models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
u'booking.booking': {
'Meta': {'ordering': "['-creation_date']", 'object_name': 'Booking'},
'booking_id': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
'booking_status': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.BookingStatus']", 'null': 'True', 'blank': 'True'}),
'city': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'country': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}),
'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'currency': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
'date_from': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'date_until': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'forename': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
'gender': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'nationality': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}),
'notes': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'phone': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'session': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['sessions.Session']", 'null': 'True', 'blank': 'True'}),
'special_request': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'street1': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'street2': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'surname': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
'time_period': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'time_unit': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64', 'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'}),
'total': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '36', 'decimal_places': '28', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'bookings'", 'null': 'True', 'to': u"orm['auth.User']"}),
'zip_code': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'})
},
u'booking.bookingerror': {
'Meta': {'object_name': 'BookingError'},
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'details': ('django.db.models.fields.TextField', [], {'max_length': '4000', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'message': ('django.db.models.fields.CharField', [], {'max_length': '1000', 'blank': 'True'})
},
u'booking.bookingitem': {
'Meta': {'ordering': "['-booking__creation_date']", 'object_name': 'BookingItem'},
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
'persons': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'quantity': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'subtotal': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '36', 'decimal_places': '28', 'blank': 'True'})
},
u'booking.bookingstatus': {
'Meta': {'object_name': 'BookingStatus'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'})
},
u'booking.bookingstatustranslation': {
'Meta': {'unique_together': "[('language_code', 'master')]", 'object_name': 'BookingStatusTranslation', 'db_table': "u'booking_bookingstatus_translation'"},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language_code': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}),
'master': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'translations'", 'null': 'True', 'to': u"orm['booking.BookingStatus']"}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'})
},
u'booking.bookingstatustranslationrenamed': {
'Meta': {'object_name': 'BookingStatusTranslationRenamed'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'status': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.BookingStatus']"})
},
u'booking.extrapersoninfo': {
'Meta': {'ordering': "['-booking__creation_date']", 'object_name': 'ExtraPersonInfo'},
'arrival': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'forename': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'message': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'surname': ('django.db.models.fields.CharField', [], {'max_length': '20'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
u'sessions.session': {
'Meta': {'object_name': 'Session', 'db_table': "'django_session'"},
'expire_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'session_data': ('django.db.models.fields.TextField', [], {}),
'session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'primary_key': 'True'})
}
}
complete_apps = ['booking']
symmetrical = True
================================================
FILE: booking/south_migrations/0009_auto__del_bookingstatustranslationrenamed.py
================================================
# flake8: noqa
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'BookingStatusTranslationRenamed'
db.delete_table(u'booking_bookingstatustranslationrenamed')
def backwards(self, orm):
# Adding model 'BookingStatusTranslationRenamed'
db.create_table(u'booking_bookingstatustranslationrenamed', (
('status', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['booking.BookingStatus'])),
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('language', self.gf('django.db.models.fields.CharField')(max_length=16)),
('name', self.gf('django.db.models.fields.CharField')(max_length=128)),
))
db.send_create_signal(u'booking', ['BookingStatusTranslationRenamed'])
models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
u'booking.booking': {
'Meta': {'ordering': "['-creation_date']", 'object_name': 'Booking'},
'booking_id': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
'booking_status': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.BookingStatus']", 'null': 'True', 'blank': 'True'}),
'city': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'country': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}),
'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'currency': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
'date_from': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'date_until': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'forename': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
'gender': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'nationality': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}),
'notes': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'phone': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'session': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['sessions.Session']", 'null': 'True', 'blank': 'True'}),
'special_request': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'street1': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'street2': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'surname': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
'time_period': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'time_unit': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64', 'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'}),
'total': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '36', 'decimal_places': '28', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'bookings'", 'null': 'True', 'to': u"orm['auth.User']"}),
'zip_code': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'})
},
u'booking.bookingerror': {
'Meta': {'object_name': 'BookingError'},
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'details': ('django.db.models.fields.TextField', [], {'max_length': '4000', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'message': ('django.db.models.fields.CharField', [], {'max_length': '1000', 'blank': 'True'})
},
u'booking.bookingitem': {
'Meta': {'ordering': "['-booking__creation_date']", 'object_name': 'BookingItem'},
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
'persons': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'quantity': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'subtotal': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '36', 'decimal_places': '28', 'blank': 'True'})
},
u'booking.bookingstatus': {
'Meta': {'object_name': 'BookingStatus'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'})
},
u'booking.bookingstatustranslation': {
'Meta': {'unique_together': "[('language_code', 'master')]", 'object_name': 'BookingStatusTranslation', 'db_table': "u'booking_bookingstatus_translation'"},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language_code': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}),
'master': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'translations'", 'null': 'True', 'to': u"orm['booking.BookingStatus']"}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'})
},
u'booking.extrapersoninfo': {
'Meta': {'ordering': "['-booking__creation_date']", 'object_name': 'ExtraPersonInfo'},
'arrival': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'forename': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'message': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'surname': ('django.db.models.fields.CharField', [], {'max_length': '20'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
u'sessions.session': {
'Meta': {'object_name': 'Session', 'db_table': "'django_session'"},
'expire_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'session_data': ('django.db.models.fields.TextField', [], {}),
'session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'primary_key': 'True'})
}
}
complete_apps = ['booking']
================================================
FILE: booking/south_migrations/0010_auto__chg_field_bookingitem_subtotal__chg_field_booking_total.py
================================================
# flake8: noqa
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'BookingItem.subtotal'
db.alter_column(u'booking_bookingitem', 'subtotal', self.gf('django.db.models.fields.DecimalField')(null=True, max_digits=36, decimal_places=2))
# Changing field 'Booking.total'
db.alter_column(u'booking_booking', 'total', self.gf('django.db.models.fields.DecimalField')(null=True, max_digits=36, decimal_places=2))
def backwards(self, orm):
# Changing field 'BookingItem.subtotal'
db.alter_column(u'booking_bookingitem', 'subtotal', self.gf('django.db.models.fields.DecimalField')(null=True, max_digits=36, decimal_places=28))
# Changing field 'Booking.total'
db.alter_column(u'booking_booking', 'total', self.gf('django.db.models.fields.DecimalField')(null=True, max_digits=36, decimal_places=28))
models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
u'booking.booking': {
'Meta': {'ordering': "['-creation_date']", 'object_name': 'Booking'},
'booking_id': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
'booking_status': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.BookingStatus']", 'null': 'True', 'blank': 'True'}),
'city': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'country': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}),
'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'currency': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
'date_from': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'date_until': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'forename': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
'gender': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'nationality': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}),
'notes': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'phone': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'session': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['sessions.Session']", 'null': 'True', 'blank': 'True'}),
'special_request': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'street1': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'street2': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'surname': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
'time_period': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'time_unit': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64', 'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '10', 'blank': 'True'}),
'total': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '36', 'decimal_places': '2', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'bookings'", 'null': 'True', 'to': u"orm['auth.User']"}),
'zip_code': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'})
},
u'booking.bookingerror': {
'Meta': {'object_name': 'BookingError'},
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'details': ('django.db.models.fields.TextField', [], {'max_length': '4000', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'message': ('django.db.models.fields.CharField', [], {'max_length': '1000', 'blank': 'True'})
},
u'booking.bookingitem': {
'Meta': {'ordering': "['-booking__creation_date']", 'object_name': 'BookingItem'},
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
'persons': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'quantity': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'subtotal': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '36', 'decimal_places': '2', 'blank': 'True'})
},
u'booking.bookingstatus': {
'Meta': {'object_name': 'BookingStatus'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'})
},
u'booking.bookingstatustranslation': {
'Meta': {'unique_together': "[('language_code', 'master')]", 'object_name': 'BookingStatusTranslation', 'db_table': "u'booking_bookingstatus_translation'"},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language_code': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}),
'master': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'translations'", 'null': 'True', 'to': u"orm['booking.BookingStatus']"}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'})
},
u'booking.extrapersoninfo': {
'Meta': {'ordering': "['-booking__creation_date']", 'object_name': 'ExtraPersonInfo'},
'arrival': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'booking': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['booking.Booking']"}),
'forename': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'message': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
'surname': ('django.db.models.fields.CharField', [], {'max_length': '20'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
u'sessions.session': {
'Meta': {'object_name': 'Session', 'db_table': "'django_session'"},
'expire_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'session_data': ('django.db.models.fields.TextField', [], {}),
'session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'primary_key': 'True'})
}
}
complete_apps = ['booking']
================================================
FILE: booking/south_migrations/__init__.py
================================================
================================================
FILE: booking/templates/booking/booking_detail.html
================================================
{% extends "base.html" %}
{% block title %}{{ object }}{% endblock %}
{% block main %}
<h1>{{ object }}</h1>
{% endblock %}
================================================
FILE: booking/templates/booking/booking_form.html
================================================
{% extends "base.html" %}
{% load i18n %}
{% block title %}{% trans "Create booking" %}{% endblock %}
{% block main %}
<h1>{% trans "Create booking" %}</h1>
<form method="post" action=".">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="{% trans "Save" %}" />
</form>
{% endblock %}
================================================
FILE: booking/templates/booking/booking_list.html
================================================
{% extends "base.html" %}
{% load i18n %}
{% block title %}{% trans "My bookings" %}{% endblock %}
{% block main %}
<h1>{% trans "My bookings" %}</h1>
<ul>
{% for booking in object_list %}
<li><a href="{% url "booking_detail" pk=booking.pk %}">{{ booking }}</a></li>
{% endfor %}
</ul>
{% endblock %}
================================================
FILE: booking/tests/__init__.py
================================================
================================================
FILE: booking/tests/forms_tests.py
================================================
"""Form tests for the ``booking`` app."""
from django.test import TestCase
from mixer.backend.django import mixer
from ..forms import BookingForm
from ..models import Booking
class BookingFormTestCase(TestCase):
longMessage = True
def setUp(self):
self.status = mixer.blend('booking.BookingStatus')
def test_form(self):
form = BookingForm()
self.assertTrue(form, msg=('Form has been initiated.'))
data = {
'gender': 'mr',
'forename': 'Foo',
'nationality': 'DE',
'street1': 'Foostreet 12',
'city': 'Foocity',
'zip_code': 'ABC123',
'country': 'DE',
}
form = BookingForm(data=data)
self.assertFalse(form.is_valid(), msg=('Form should be invalid.'))
data.update({'surname': 'Bar'})
form = BookingForm(data=data)
self.assertTrue(form.is_valid(), msg=('Form should be valid.'))
form.save()
self.assertEqual(Booking.objects.count(), 1, msg=(
'One booking should have been created.'))
self.assertEqual(
Booking.objects.all()[0].booking_status.slug,
'pending', msg=('Slug of status should be pending.'))
================================================
FILE: booking/tests/models_tests.py
================================================
"""Tests for the models of the booking app."""
from django.test import TestCase
from mixer.backend.django import mixer
class BookingTestCase(TestCase):
longMessage = True
def setUp(self):
self.booking = mixer.blend('booking.Booking')
def test_instance(self):
self.assertTrue(self.booking.pk, msg=(
'Booking model should have been created.'))
class BookingItemTestCase(TestCase):
longMessage = True
def setUp(self):
self.booking_item = mixer.blend('booking.BookingItem')
def test_instance(self):
self.assertTrue(self.booking_item.pk, msg=(
'Booking item model should have been created.'))
class BookingErrorTestCase(TestCase):
"""Tests for the ``BookingError`` model class."""
longMessage = True
def test_instantiation(self):
bookingerror = mixer.blend('booking.BookingError')
self.assertTrue(bookingerror.pk)
class BookingStatusTestCase(TestCase):
longMessage = True
def setUp(self):
self.booking_status = mixer.blend('booking.BookingStatus')
def test_instance(self):
self.assertTrue(self.booking_status.pk, msg=(
'Booking status model should have been created.'))
class ExtraPersonInfoTestCase(TestCase):
longMessage = True
def setUp(self):
self.info = mixer.blend('booking.ExtraPersonInfo')
def test_instance(self):
self.assertTrue(self.info.pk, msg=(
'Person info model should have been created.'))
================================================
FILE: booking/tests/settings.py
================================================
"""
These settings are used by the ``manage.py`` command.
With normal tests we want to use the fastest possible way which is an
in-memory sqlite database but if you want to create South south_migrations you
need a persistant database.
Unfortunately there seems to be an issue with either South or syncdb so that
defining two routers ("default" and "south") does not work.
"""
from distutils.version import StrictVersion
import django
from .test_settings import * # NOQA
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'db.sqlite',
}
}
django_version = django.get_version()
if StrictVersion(django_version) < StrictVersion('1.7'):
INSTALLED_APPS.append('south', )
================================================
FILE: booking/tests/test_app/__init__.py
================================================
================================================
FILE: booking/tests/test_app/models.py
================================================
================================================
FILE: booking/tests/test_app/templates/400.html
================================================
================================================
FILE: booking/tests/test_app/templates/500.html
================================================
================================================
FILE: booking/tests/test_app/templates/base.html
================================================
<!DOCTYPE html>
<html>
<head>
<title>{% block title %}{% endblock %}</title>
</head>
<body>
{% block main %}{% endblock %}
</body>
</html>
================================================
FILE: booking/tests/test_settings.py
================================================
"""Settings that need to be set in order to run the tests."""
import os
DEBUG = True
SITE_ID = 1
APP_ROOT = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..'))
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
ROOT_URLCONF = 'booking.tests.urls'
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(APP_ROOT, '../app_static')
MEDIA_ROOT = os.path.join(APP_ROOT, '../app_media')
STATICFILES_DIRS = (
os.path.join(APP_ROOT, 'static'),
)
TEMPLATES = [{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True,
'DIRS': [os.path.join(APP_ROOT, 'tests/test_app/templates')],
'OPTIONS': {
'context_processors': (
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.request',
)
}
}]
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)
EXTERNAL_APPS = [
'django.contrib.admin',
'django.contrib.admindocs',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.messages',
'django.contrib.sessions',
'django.contrib.staticfiles',
'django.contrib.sitemaps',
'django.contrib.sites',
]
INTERNAL_APPS = [
'booking',
'booking.tests.test_app',
]
INSTALLED_APPS = EXTERNAL_APPS + INTERNAL_APPS
SECRET_KEY = 'foobar'
================================================
FILE: booking/tests/urls.py
================================================
"""URLs to run the tests."""
try:
from django.conf.urls import include, url
except ImportError: # Pre-Django 1.4 version
from django.conf.urls.defaults import include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^booking/', include('booking.urls')),
]
================================================
FILE: booking/tests/views_tests.py
================================================
"""View tests for the ``booking`` app."""
from django.test import TestCase
from django_libs.tests.mixins import ViewRequestFactoryTestMixin
from mixer.backend.django import mixer
from .. import views
from ..models import Booking
class BookingCreateViewTestCase(ViewRequestFactoryTestMixin, TestCase):
view_class = views.BookingCreateView
def setUp(self):
self.user = mixer.blend('auth.User')
def test_view(self):
self.is_callable(add_session=True)
data = {
'gender': 'mr',
'forename': 'Foo',
'surname': 'Bar',
'nationality': 'DE',
'street1': 'Foostreet 12',
'city': 'Foocity',
'zip_code': 'ABC123',
'country': 'DE',
}
self.is_postable(data=data, add_session=True,
to_url_name='booking_detail')
self.assertEqual(Booking.objects.count(), 1, msg=(
'One booking should have been created.'))
self.assertTrue(Booking.objects.all()[0].session.session_key, msg=(
'Booking should have a session key.'))
self.is_postable(data=data, add_session=True,
to_url_name='booking_detail')
self.assertEqual(Booking.objects.count(), 2, msg=(
'Another booking should have been created.'))
self.is_postable(data=data, user=self.user, add_session=True,
to_url_name='booking_detail')
self.assertEqual(self.user.bookings.count(), 1, msg=(
'User should have a new booking.'))
self.assertTrue(Booking.objects.all()[0].user.username, msg=(
'Booking should have a user.'))
class BookingDetailViewTestCase(ViewRequestFactoryTestMixin, TestCase):
view_class = views.BookingDetailView
def setUp(self):
self.user = mixer.blend('auth.User')
self.booking = mixer.blend('booking.Booking')
def get_view_kwargs(self):
return {'pk': self.booking.pk}
def test_view(self):
self.is_not_callable()
self.is_not_callable(user=self.user)
self.booking = mixer.blend('booking.Booking', user=self.user)
self.is_callable(user=self.user)
class BookingListViewTestCase(ViewRequestFactoryTestMixin, TestCase):
view_class = views.BookingListView
def setUp(self):
self.user = mixer.blend('auth.User')
mixer.blend('booking.Booking', user=self.user)
def test_view(self):
self.is_callable(user=self.user)
================================================
FILE: booking/urls.py
================================================
"""URLs for the booking app."""
try:
from django.conf.urls import url
except ImportError: # Pre-Django 1.4 version
from django.conf.urls.defaults import url
from . import views
urlpatterns = [
url(r'^(?P<pk>\d+)/$',
views.BookingDetailView.as_view(),
name='booking_detail'),
url(r'^create/$',
views.BookingCreateView.as_view(),
name='booking_create'),
url(r'^$', views.BookingListView.as_view(), name='booking_list'),
]
================================================
FILE: booking/utils.py
================================================
"""Utils for the booking app."""
from django.contrib.sessions.models import Session
from .models import Booking
def get_booking(request):
"""
Returns the booking that is in progress for the current user or None
We assume that a user can only have one booking that is in-progress.
TODO: This implementation assumes that there is a status called
'inprogress' and that there should only be one such booking for a given
user. We need to see if this can be more generic for future projects.
:param request: The Request object.
"""
booking = None
if request.user.is_authenticated():
try:
booking = Booking.objects.get(
user=request.user,
booking_status__slug='inprogress')
except Booking.DoesNotExist:
# The user does not have any open bookings
pass
else:
session = Session.objects.get(
session_key=request.session.session_key)
try:
booking = Booking.objects.get(session=session)
except Booking.DoesNotExist:
# The user does not have any bookings in his session
pass
return booking
def persist_booking(booking, user):
"""
Ties an in-progress booking from a session to a user when the user logs in.
If we don't do this, the booking will be lost, because on a login, the
old session will be deleted and a new one will be created. Since the
booking has a FK to the session, it would be deleted as well when the user
logs in.
We assume that a user can only have one booking that is in-progress.
Therefore we will delete any existing in-progress bookings of this user
before tying the one from the session to the user.
TODO: Find a more generic solution for this, as this assumes that there is
a status called inprogress and that a user can only have one such booking.
:param booking: The booking that should be tied to the user.
:user: The user the booking should be tied to.
"""
if booking is not None:
existing_bookings = Booking.objects.filter(
user=user, booking_status__slug='inprogress').exclude(
pk=booking.pk)
existing_bookings.delete()
booking.session = None
booking.user = user
booking.save()
================================================
FILE: booking/views.py
================================================
"""Views for the booking app."""
from django.contrib.auth.decorators import login_required
from django.contrib.sessions.models import Session
from django.core.urlresolvers import reverse
from django.http import Http404
from django.utils.decorators import method_decorator
from django.views.generic import CreateView, DetailView, ListView
from .forms import BookingForm
from .models import Booking
# ------ MIXINS ------ #
class BookingViewMixin(object):
model = Booking
form_class = BookingForm
# ------ MODEL VIEWS ------ #
class BookingCreateView(BookingViewMixin, CreateView):
"""View to create a new ``Booking`` instance."""
def get_success_url(self):
return reverse('booking_detail', kwargs={'pk': self.object.pk})
def get_form_kwargs(self, *args, **kwargs):
kwargs = super(BookingCreateView, self).get_form_kwargs(
*args, **kwargs)
if self.request.user.is_authenticated():
kwargs.update({'user': self.request.user})
else:
# If the user is not authenticated, get the current session
if not self.request.session.exists(
self.request.session.session_key):
self.request.session.create()
kwargs.update({'session': Session.objects.get(
session_key=self.request.session.session_key)})
return kwargs
class BookingDetailView(BookingViewMixin, DetailView):
"""View to display a ``Booking`` instance."""
def dispatch(self, request, *args, **kwargs):
self.kwargs = kwargs
self.object = self.get_object()
if request.user.is_authenticated():
# If user doesn't own the booking forbid access
if not self.object.user == request.user:
raise Http404
else:
# If anonymous doesn't own the booking forbid access
session = self.object.session
if (not session or not request.session.session_key or
session.session_key != request.session.session_key):
raise Http404
return super(BookingViewMixin, self).dispatch(request, *args, **kwargs)
class BookingListView(BookingViewMixin, ListView):
"""View to display all ``Booking`` instances of one user."""
@method_decorator(login_required)
def dispatch(self, request, *args, **kwargs):
return super(BookingViewMixin, self).dispatch(request, *args, **kwargs)
def get_queryset(self):
return self.request.user.bookings.all()
================================================
FILE: manage.py
================================================
#!/usr/bin/env python
import os
import sys
if __name__ == '__main__':
os.environ.setdefault(
'DJANGO_SETTINGS_MODULE', 'booking.tests.settings')
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
================================================
FILE: requirements.txt
================================================
django
django-hvad
django-countries
django-libs
================================================
FILE: runtests.py
================================================
#!/usr/bin/env python
"""
This script is used to run tests, create a coverage report and output the
statistics at the end of the tox run.
To run this script just execute ``tox``
"""
import re
from fabric.api import local, warn
from fabric.colors import green, red
if __name__ == '__main__':
local('flake8 --ignore=E126 --ignore=W391 --statistics'
' --exclude=submodules,south_migrations,migrations,build .')
local('coverage run --source="booking" manage.py test -v 2'
' --traceback --failfast'
' --settings=booking.tests.settings'
' --pattern="*_tests.py"')
local('coverage html -d coverage --omit="*__init__*,*/settings/*,'
'*/south_migrations/*,*/migrations/*,*/tests/*,*admin*"')
total_line = local('grep -n pc_cov coverage/index.html', capture=True)
percentage = float(re.findall(r'(\d+)%', total_line)[-1])
if percentage < 100:
warn(red('Coverage is {0}%'.format(percentage)))
print(green('Coverage is {0}%'.format(percentage)))
================================================
FILE: setup.py
================================================
# -*- encoding: utf-8 -*-
"""
Python setup file for the booking app.
In order to register your app at pypi.python.org, create an account at
pypi.python.org and login, then register your new app like so:
python setup.py register
If your name is still free, you can now make your first release but first you
should check if you are uploading the correct files:
python setup.py sdist
Inspect the output thoroughly. There shouldn't be any temp files and if your
app includes staticfiles or templates, make sure that they appear in the list.
If something is wrong, you need to edit MANIFEST.in and run the command again.
If all looks good, you can make your first release:
python setup.py sdist upload
For new releases, you need to bump the version number in
booking/__init__.py and re-run the above command.
For more information on creating source distributions, see
http://docs.python.org/2/distutils/sourcedist.html
"""
import os
from setuptools import setup, find_packages
import booking as app
def read(fname):
try:
return open(os.path.join(os.path.dirname(__file__), fname)).read()
except IOError:
return ''
setup(
name="django-booking",
version=app.__version__,
description=read('DESCRIPTION'),
long_description=read('README.rst'),
license='The MIT License',
platforms=['OS Independent'],
keywords='django, app, reusable, booking',
author='Daniel Kaufhold',
author_email='daniel.kaufhold.com',
url="https://github.com/bitmazk/django-booking",
packages=find_packages(),
include_package_data=True,
install_requires=[
'Django',
'django-hvad',
'django-countries',
'django-libs',
],
)
================================================
FILE: test_requirements.txt
================================================
coverage
django-coverage
ipdb
flake8
fabric3
mixer
tox
================================================
FILE: tox.ini
================================================
[tox]
envlist = py27-django{18,19},py35-django19
[testenv]
usedevelop = True
deps =
django18: Django>=1.8,<1.9
django19: Django>=1.9,<1.10
-rtest_requirements.txt
commands = python runtests.py
gitextract_cau12x4p/ ├── .gitignore ├── .travis.yml ├── AUTHORS ├── CHANGELOG.txt ├── DESCRIPTION ├── LICENSE ├── MANIFEST.in ├── README.rst ├── booking/ │ ├── __init__.py │ ├── admin.py │ ├── auth_backends.py │ ├── forms.py │ ├── migrations/ │ │ ├── 0001_initial.py │ │ └── __init__.py │ ├── models.py │ ├── south_migrations/ │ │ ├── 0001_initial.py │ │ ├── 0002_auto__chg_field_booking_booking_status.py │ │ ├── 0003_auto__add_field_booking_time_period__add_field_booking_time_unit.py │ │ ├── 0004_auto__add_field_bookingitem_subtotal__add_field_booking_total__add_fie.py │ │ ├── 0005_auto__add_bookingerror.py │ │ ├── 0006_rename_bookingstatustranslation.py │ │ ├── 0007_auto__add_bookingstatustranslation__add_unique_bookingstatustranslatio.py │ │ ├── 0008_move_data_from_old_model_to_hvad.py │ │ ├── 0009_auto__del_bookingstatustranslationrenamed.py │ │ ├── 0010_auto__chg_field_bookingitem_subtotal__chg_field_booking_total.py │ │ └── __init__.py │ ├── templates/ │ │ └── booking/ │ │ ├── booking_detail.html │ │ ├── booking_form.html │ │ └── booking_list.html │ ├── tests/ │ │ ├── __init__.py │ │ ├── forms_tests.py │ │ ├── models_tests.py │ │ ├── settings.py │ │ ├── test_app/ │ │ │ ├── __init__.py │ │ │ ├── models.py │ │ │ └── templates/ │ │ │ ├── 400.html │ │ │ ├── 500.html │ │ │ └── base.html │ │ ├── test_settings.py │ │ ├── urls.py │ │ └── views_tests.py │ ├── urls.py │ ├── utils.py │ └── views.py ├── manage.py ├── requirements.txt ├── runtests.py ├── setup.py ├── test_requirements.txt └── tox.ini
SYMBOL INDEX (95 symbols across 21 files)
FILE: booking/admin.py
class BookingAdmin (line 9) | class BookingAdmin(admin.ModelAdmin):
class BookingItemAdmin (line 16) | class BookingItemAdmin(admin.ModelAdmin):
FILE: booking/auth_backends.py
class BookingIDBackend (line 7) | class BookingIDBackend(ModelBackend):
method authenticate (line 12) | def authenticate(self, username=None, password=None, **kwargs):
FILE: booking/forms.py
class BookingForm (line 11) | class BookingForm(forms.ModelForm):
method __init__ (line 12) | def __init__(self, session=None, user=None, *args, **kwargs):
method save (line 28) | def save(self, *args, **kwargs):
class Meta (line 37) | class Meta:
class BookingIDAuthenticationForm (line 44) | class BookingIDAuthenticationForm(AuthenticationForm):
method __init__ (line 45) | def __init__(self, *args, **kwargs):
method clean_username (line 52) | def clean_username(self):
method clean (line 56) | def clean(self):
FILE: booking/migrations/0001_initial.py
class Migration (line 12) | class Migration(migrations.Migration):
FILE: booking/models.py
class BookingStatus (line 14) | class BookingStatus(TranslationModelMixin, TranslatableModel):
class Booking (line 38) | class Booking(models.Model):
class Meta (line 232) | class Meta:
method __str__ (line 235) | def __str__(self):
class BookingError (line 241) | class BookingError(models.Model):
method __str__ (line 277) | def __str__(self):
class BookingItem (line 283) | class BookingItem(models.Model):
class Meta (line 324) | class Meta:
method __str__ (line 327) | def __str__(self):
method price (line 331) | def price(self):
class ExtraPersonInfo (line 336) | class ExtraPersonInfo(models.Model):
class Meta (line 373) | class Meta:
method __str__ (line 376) | def __str__(self):
FILE: booking/south_migrations/0001_initial.py
class Migration (line 9) | class Migration(SchemaMigration):
method forwards (line 11) | def forwards(self, orm):
method backwards (line 78) | def backwards(self, orm):
FILE: booking/south_migrations/0002_auto__chg_field_booking_booking_status.py
class Migration (line 9) | class Migration(SchemaMigration):
method forwards (line 11) | def forwards(self, orm):
method backwards (line 16) | def backwards(self, orm):
FILE: booking/south_migrations/0003_auto__add_field_booking_time_period__add_field_booking_time_unit.py
class Migration (line 9) | class Migration(SchemaMigration):
method forwards (line 11) | def forwards(self, orm):
method backwards (line 23) | def backwards(self, orm):
FILE: booking/south_migrations/0004_auto__add_field_bookingitem_subtotal__add_field_booking_total__add_fie.py
class Migration (line 9) | class Migration(SchemaMigration):
method forwards (line 11) | def forwards(self, orm):
method backwards (line 28) | def backwards(self, orm):
FILE: booking/south_migrations/0005_auto__add_bookingerror.py
class Migration (line 9) | class Migration(SchemaMigration):
method forwards (line 11) | def forwards(self, orm):
method backwards (line 23) | def backwards(self, orm):
FILE: booking/south_migrations/0006_rename_bookingstatustranslation.py
class Migration (line 9) | class Migration(SchemaMigration):
method forwards (line 11) | def forwards(self, orm):
method backwards (line 14) | def backwards(self, orm):
FILE: booking/south_migrations/0007_auto__add_bookingstatustranslation__add_unique_bookingstatustranslatio.py
class Migration (line 9) | class Migration(SchemaMigration):
method forwards (line 11) | def forwards(self, orm):
method backwards (line 25) | def backwards(self, orm):
FILE: booking/south_migrations/0008_move_data_from_old_model_to_hvad.py
class Migration (line 8) | class Migration(DataMigration):
method forwards (line 10) | def forwards(self, orm):
method backwards (line 22) | def backwards(self, orm):
FILE: booking/south_migrations/0009_auto__del_bookingstatustranslationrenamed.py
class Migration (line 9) | class Migration(SchemaMigration):
method forwards (line 11) | def forwards(self, orm):
method backwards (line 16) | def backwards(self, orm):
FILE: booking/south_migrations/0010_auto__chg_field_bookingitem_subtotal__chg_field_booking_total.py
class Migration (line 9) | class Migration(SchemaMigration):
method forwards (line 11) | def forwards(self, orm):
method backwards (line 19) | def backwards(self, orm):
FILE: booking/tests/forms_tests.py
class BookingFormTestCase (line 10) | class BookingFormTestCase(TestCase):
method setUp (line 13) | def setUp(self):
method test_form (line 16) | def test_form(self):
FILE: booking/tests/models_tests.py
class BookingTestCase (line 7) | class BookingTestCase(TestCase):
method setUp (line 10) | def setUp(self):
method test_instance (line 13) | def test_instance(self):
class BookingItemTestCase (line 18) | class BookingItemTestCase(TestCase):
method setUp (line 21) | def setUp(self):
method test_instance (line 24) | def test_instance(self):
class BookingErrorTestCase (line 29) | class BookingErrorTestCase(TestCase):
method test_instantiation (line 33) | def test_instantiation(self):
class BookingStatusTestCase (line 38) | class BookingStatusTestCase(TestCase):
method setUp (line 41) | def setUp(self):
method test_instance (line 44) | def test_instance(self):
class ExtraPersonInfoTestCase (line 49) | class ExtraPersonInfoTestCase(TestCase):
method setUp (line 52) | def setUp(self):
method test_instance (line 55) | def test_instance(self):
FILE: booking/tests/views_tests.py
class BookingCreateViewTestCase (line 11) | class BookingCreateViewTestCase(ViewRequestFactoryTestMixin, TestCase):
method setUp (line 14) | def setUp(self):
method test_view (line 17) | def test_view(self):
class BookingDetailViewTestCase (line 49) | class BookingDetailViewTestCase(ViewRequestFactoryTestMixin, TestCase):
method setUp (line 52) | def setUp(self):
method get_view_kwargs (line 56) | def get_view_kwargs(self):
method test_view (line 59) | def test_view(self):
class BookingListViewTestCase (line 66) | class BookingListViewTestCase(ViewRequestFactoryTestMixin, TestCase):
method setUp (line 69) | def setUp(self):
method test_view (line 73) | def test_view(self):
FILE: booking/utils.py
function get_booking (line 7) | def get_booking(request):
function persist_booking (line 40) | def persist_booking(booking, user):
FILE: booking/views.py
class BookingViewMixin (line 15) | class BookingViewMixin(object):
class BookingCreateView (line 22) | class BookingCreateView(BookingViewMixin, CreateView):
method get_success_url (line 24) | def get_success_url(self):
method get_form_kwargs (line 27) | def get_form_kwargs(self, *args, **kwargs):
class BookingDetailView (line 42) | class BookingDetailView(BookingViewMixin, DetailView):
method dispatch (line 44) | def dispatch(self, request, *args, **kwargs):
class BookingListView (line 60) | class BookingListView(BookingViewMixin, ListView):
method dispatch (line 63) | def dispatch(self, request, *args, **kwargs):
method get_queryset (line 66) | def get_queryset(self):
FILE: setup.py
function read (line 35) | def read(fname):
Condensed preview — 50 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (161K chars).
[
{
"path": ".gitignore",
"chars": 98,
"preview": "*.egg-info/\n*.pyc\n*coverage/\ndb.sqlite\ndist/\ndocs/_build/\napp_media/\napp_static/\n.coverage\n*.tox/\n"
},
{
"path": ".travis.yml",
"chars": 136,
"preview": "language: python\npython:\n - \"2.7\"\ninstall: pip install -r test_requirements.txt --use-mirrors\nscript: python booking/te"
},
{
"path": "AUTHORS",
"chars": 140,
"preview": "Current or previous core committers\n\nDaniel Kaufhold\n\nContributors (in alphabetical order)\n\n* Tobias Lorenz\n* Your name "
},
{
"path": "CHANGELOG.txt",
"chars": 753,
"preview": "=== (ongoing 0.7.X) To be released as 0.8 ===\n\n- Prepared app for Django 1.9 and Python 3.5\n- Fixed dependencies\n- Fixed"
},
{
"path": "DESCRIPTION",
"chars": 66,
"preview": "A reusable Django app that manages bookings for various purposes.\n"
},
{
"path": "LICENSE",
"chars": 1082,
"preview": "The MIT License (MIT)\nCopyright (c) 2013 Daniel Kaufhold \n\nPermission is hereby granted, free of charge, to any person o"
},
{
"path": "MANIFEST.in",
"chars": 202,
"preview": "include AUTHORS\ninclude LICENSE\ninclude DESCRIPTION\ninclude CHANGELOG.txt\ninclude README.md\ngraft booking\nglobal-exclude"
},
{
"path": "README.rst",
"chars": 3502,
"preview": "Django Booking\n==============\n\nA reusable Django app that manages bookings for various purposes.\n\nInstallation\n---------"
},
{
"path": "booking/__init__.py",
"chars": 46,
"preview": "# -*- coding: utf-8 -*-\n__version__ = '0.7.2'\n"
},
{
"path": "booking/admin.py",
"chars": 694,
"preview": "\"\"\"Admin classes for the booking app.\"\"\"\nfrom django.contrib import admin\n\nfrom hvad.admin import TranslatableAdmin\n\nfro"
},
{
"path": "booking/auth_backends.py",
"chars": 548,
"preview": "\"\"\"Custom authentication backends for the booking app.\"\"\"\nfrom django.contrib.auth.backends import ModelBackend\n\nfrom .m"
},
{
"path": "booking/forms.py",
"chars": 3019,
"preview": "\"\"\"Forms for the ``booking`` app.\"\"\"\nfrom django import forms\nfrom django.conf import settings\nfrom django.contrib.auth "
},
{
"path": "booking/migrations/0001_initial.py",
"chars": 7978,
"preview": "# -*- coding: utf-8 -*-\n# Generated by Django 1.9.5 on 2016-04-18 15:40\nfrom __future__ import unicode_literals\n\nfrom dj"
},
{
"path": "booking/migrations/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "booking/models.py",
"chars": 10058,
"preview": "\"\"\"Models for the ``booking`` app.\"\"\"\nfrom django.conf import settings\nfrom django.contrib.contenttypes.fields import Ge"
},
{
"path": "booking/south_migrations/0001_initial.py",
"chars": 13648,
"preview": "# flake8: noqa\n# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom"
},
{
"path": "booking/south_migrations/0002_auto__chg_field_booking_booking_status.py",
"chars": 9375,
"preview": "# flake8: noqa\n# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom"
},
{
"path": "booking/south_migrations/0003_auto__add_field_booking_time_period__add_field_booking_time_unit.py",
"chars": 9608,
"preview": "# flake8: noqa\n# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom"
},
{
"path": "booking/south_migrations/0004_auto__add_field_bookingitem_subtotal__add_field_booking_total__add_fie.py",
"chars": 10394,
"preview": "# flake8: noqa\n# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom"
},
{
"path": "booking/south_migrations/0005_auto__add_bookingerror.py",
"chars": 10668,
"preview": "# flake8: noqa\n# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom"
},
{
"path": "booking/south_migrations/0006_rename_bookingstatustranslation.py",
"chars": 10146,
"preview": "# flake8: noqa\n# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom"
},
{
"path": "booking/south_migrations/0007_auto__add_bookingstatustranslation__add_unique_bookingstatustranslatio.py",
"chars": 11751,
"preview": "# flake8: noqa\n# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom"
},
{
"path": "booking/south_migrations/0008_move_data_from_old_model_to_hvad.py",
"chars": 11224,
"preview": "# flake8: noqa\n# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import DataMigration\nfrom d"
},
{
"path": "booking/south_migrations/0009_auto__del_bookingstatustranslationrenamed.py",
"chars": 10815,
"preview": "# flake8: noqa\n# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom"
},
{
"path": "booking/south_migrations/0010_auto__chg_field_bookingitem_subtotal__chg_field_booking_total.py",
"chars": 10881,
"preview": "# flake8: noqa\n# -*- coding: utf-8 -*-\nimport datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom"
},
{
"path": "booking/south_migrations/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "booking/templates/booking/booking_detail.html",
"chars": 130,
"preview": "{% extends \"base.html\" %}\n\n{% block title %}{{ object }}{% endblock %}\n\n{% block main %}\n <h1>{{ object }}</h1>\n{% en"
},
{
"path": "booking/templates/booking/booking_form.html",
"chars": 334,
"preview": "{% extends \"base.html\" %}\n{% load i18n %}\n\n{% block title %}{% trans \"Create booking\" %}{% endblock %}\n\n{% block main %}"
},
{
"path": "booking/templates/booking/booking_list.html",
"chars": 343,
"preview": "{% extends \"base.html\" %}\n{% load i18n %}\n\n{% block title %}{% trans \"My bookings\" %}{% endblock %}\n\n{% block main %}\n "
},
{
"path": "booking/tests/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "booking/tests/forms_tests.py",
"chars": 1240,
"preview": "\"\"\"Form tests for the ``booking`` app.\"\"\"\nfrom django.test import TestCase\n\nfrom mixer.backend.django import mixer\n\nfrom"
},
{
"path": "booking/tests/models_tests.py",
"chars": 1510,
"preview": "\"\"\"Tests for the models of the booking app.\"\"\"\nfrom django.test import TestCase\n\nfrom mixer.backend.django import mixer\n"
},
{
"path": "booking/tests/settings.py",
"chars": 725,
"preview": "\n\"\"\"\nThese settings are used by the ``manage.py`` command.\nWith normal tests we want to use the fastest possible way whi"
},
{
"path": "booking/tests/test_app/__init__.py",
"chars": 0,
"preview": ""
},
{
"path": "booking/tests/test_app/models.py",
"chars": 0,
"preview": ""
},
{
"path": "booking/tests/test_app/templates/400.html",
"chars": 0,
"preview": ""
},
{
"path": "booking/tests/test_app/templates/500.html",
"chars": 0,
"preview": ""
},
{
"path": "booking/tests/test_app/templates/base.html",
"chars": 144,
"preview": "<!DOCTYPE html>\n<html>\n<head>\n <title>{% block title %}{% endblock %}</title>\n</head>\n<body>\n\n{% block main %}{% endb"
},
{
"path": "booking/tests/test_settings.py",
"chars": 1524,
"preview": "\"\"\"Settings that need to be set in order to run the tests.\"\"\"\nimport os\n\nDEBUG = True\n\nSITE_ID = 1\n\nAPP_ROOT = os.path.a"
},
{
"path": "booking/tests/urls.py",
"chars": 351,
"preview": "\"\"\"URLs to run the tests.\"\"\"\ntry:\n from django.conf.urls import include, url\nexcept ImportError: # Pre-Django 1.4 ve"
},
{
"path": "booking/tests/views_tests.py",
"chars": 2510,
"preview": "\"\"\"View tests for the ``booking`` app.\"\"\"\nfrom django.test import TestCase\n\nfrom django_libs.tests.mixins import ViewReq"
},
{
"path": "booking/urls.py",
"chars": 476,
"preview": "\"\"\"URLs for the booking app.\"\"\"\ntry:\n from django.conf.urls import url\nexcept ImportError: # Pre-Django 1.4 version\n"
},
{
"path": "booking/utils.py",
"chars": 2336,
"preview": "\"\"\"Utils for the booking app.\"\"\"\nfrom django.contrib.sessions.models import Session\n\nfrom .models import Booking\n\n\ndef g"
},
{
"path": "booking/views.py",
"chars": 2524,
"preview": "\"\"\"Views for the booking app.\"\"\"\nfrom django.contrib.auth.decorators import login_required\nfrom django.contrib.sessions."
},
{
"path": "manage.py",
"chars": 263,
"preview": "#!/usr/bin/env python\nimport os\nimport sys\n\nif __name__ == '__main__':\n os.environ.setdefault(\n 'DJANGO_SETTIN"
},
{
"path": "requirements.txt",
"chars": 48,
"preview": "django\ndjango-hvad\ndjango-countries\ndjango-libs\n"
},
{
"path": "runtests.py",
"chars": 1023,
"preview": "#!/usr/bin/env python\n\"\"\"\nThis script is used to run tests, create a coverage report and output the\nstatistics at the en"
},
{
"path": "setup.py",
"chars": 1719,
"preview": "# -*- encoding: utf-8 -*-\n\"\"\"\nPython setup file for the booking app.\n\nIn order to register your app at pypi.python.org, "
},
{
"path": "test_requirements.txt",
"chars": 55,
"preview": "coverage\ndjango-coverage\nipdb\nflake8\nfabric3\nmixer\ntox\n"
},
{
"path": "tox.ini",
"chars": 206,
"preview": "[tox]\nenvlist = py27-django{18,19},py35-django19\n\n[testenv]\nusedevelop = True\ndeps =\n django18: Django>=1.8,<1.9\n "
}
]
About this extraction
This page contains the full source code of the bitlabstudio/django-booking GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 50 files (150.7 KB), approximately 37.3k tokens, and a symbol index with 95 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.