Commit b8192f9b authored by Patrick Kimber's avatar Patrick Kimber

Django 2

parent 10c5f952
Pipeline #23581723 passed with stage
in 1 minute and 40 seconds
......@@ -40,6 +40,7 @@ venv-*
# dev
.cache/
.pytest_cache/
# private info
.private
......
......@@ -79,7 +79,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='booking',
name='category',
field=models.ForeignKey(to='booking.Category', null=True, blank=True),
field=models.ForeignKey(to='booking.Category', null=True, blank=True, on_delete=models.CASCADE),
preserve_default=True,
),
migrations.AddField(
......@@ -97,7 +97,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='booking',
name='location',
field=models.ForeignKey(to='booking.Location', null=True, blank=True),
field=models.ForeignKey(to='booking.Location', null=True, blank=True, on_delete=models.CASCADE),
preserve_default=True,
),
migrations.AddField(
......@@ -115,7 +115,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='booking',
name='permission',
field=models.ForeignKey(to='booking.Permission', null=True, blank=True),
field=models.ForeignKey(to='booking.Permission', null=True, blank=True, on_delete=models.CASCADE),
preserve_default=True,
),
migrations.AddField(
......
......@@ -43,7 +43,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='booking',
name='permission',
field=models.ForeignKey(default=booking.models.default_permission, to='booking.Permission'),
field=models.ForeignKey(default=booking.models.default_permission, to='booking.Permission', on_delete=models.CASCADE),
preserve_default=True,
),
migrations.AlterField(
......
......@@ -19,7 +19,7 @@ class Migration(migrations.Migration):
('modified', models.DateTimeField(auto_now=True)),
('name', models.CharField(max_length=200)),
('deleted', models.BooleanField(default=False)),
('booking', models.ForeignKey(to='booking.Booking')),
('booking', models.ForeignKey(to='booking.Booking', on_delete=models.CASCADE)),
],
options={
'verbose_name': 'Rota',
......@@ -47,7 +47,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='rota',
name='rota',
field=models.ForeignKey(to='booking.RotaType'),
field=models.ForeignKey(to='booking.RotaType', on_delete=models.CASCADE),
preserve_default=True,
),
migrations.AddField(
......
......@@ -272,8 +272,16 @@ class BookingManager(models.Manager):
class Booking(TimeStampedModel):
permission= models.ForeignKey(Permission, default=default_permission)
category = models.ForeignKey(Category, blank=True, null=True)
permission= models.ForeignKey(
Permission,
default=default_permission,
on_delete=models.CASCADE,
)
category = models.ForeignKey(
Category,
blank=True, null=True,
on_delete=models.CASCADE,
)
title = models.CharField(max_length=200, blank=True)
start_date = models.DateField(help_text='(dd/mm/yyyy)')
start_time = models.TimeField(
......@@ -288,7 +296,11 @@ class Booking(TimeStampedModel):
blank=True, null=True,
help_text="Please enter in 24 hour format e.g. 21:00",
)
location = models.ForeignKey(Location, blank=True, null=True)
location = models.ForeignKey(
Location,
blank=True, null=True,
on_delete=models.CASCADE,
)
description = models.TextField(blank=True)
picture = models.ImageField(upload_to='booking', blank=True)
notes_user = models.TextField(
......@@ -359,8 +371,8 @@ reversion.register(RotaType)
class Rota(TimeStampedModel):
booking = models.ForeignKey(Booking)
rota = models.ForeignKey(RotaType)
booking = models.ForeignKey(Booking, on_delete=models.CASCADE)
rota = models.ForeignKey(RotaType, on_delete=models.CASCADE)
name = models.CharField(max_length=200)
deleted = models.BooleanField(default=False)
......
......@@ -4,8 +4,8 @@ from datetime import (
timedelta,
)
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.urls import reverse
from booking.models import Booking
from booking.tests.scenario import (
......
# -*- encoding: utf-8 -*-
from datetime import date
from django.urls import reverse
from django.utils import timezone
from django.core.urlresolvers import reverse
from base.tests.test_utils import PermTestCase
from .factories import (
......
......@@ -5,11 +5,11 @@ from dateutil.relativedelta import relativedelta
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.http import (
Http404,
HttpResponse,
)
from django.urls import reverse
from django.views.generic import (
CreateView,
DeleteView,
......
......@@ -5,7 +5,7 @@ import os
# Normally you should not import ANYTHING from Django directly into your
# settings, but 'ImproperlyConfigured' is an exception.
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import reverse_lazy
from django.urls import reverse_lazy
def get_env_variable(key):
......@@ -95,7 +95,7 @@ STATICFILES_FINDERS = (
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'w@t8%tdwyi-n$u_s#4_+cwnq&6)1n)l3p-qe(ziala0j^vo12d'
MIDDLEWARE_CLASSES = (
MIDDLEWARE = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
......
......@@ -4,7 +4,7 @@ from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.core.urlresolvers import reverse_lazy
from django.urls import path, reverse_lazy
from django.views.generic import RedirectView
from booking.forms import (
......@@ -25,6 +25,7 @@ admin.autodiscover()
urlpatterns = [
path('admin/', admin.site.urls),
url(regex=r'^$',
view=HomeView.as_view(),
name='project.home'
......@@ -32,9 +33,6 @@ urlpatterns = [
url(regex=r'^',
view=include('login.urls')
),
url(regex=r'^admin/',
view=include(admin.site.urls)
),
url(regex=r'^booking/create/$',
view=BookingCreateView.as_view(form_class=BookingEventForm),
name='booking.create'
......
bleach==2.0.0
celery==3.1.25
django-braces==1.11.0
django-redis==4.6.0
django-reversion==2.0.8
bleach==2.1.3
celery==3.1.26.post2
django-braces==1.13.0
django-redis==4.8.0
django-reversion==2.0.13
django-sendfile==0.3.11
Django==1.11.2
easy-thumbnails==2.4.1
pillow==4.1.1
python-dateutil==2.6.0
pytz==2017.2
redis==2.10.5
Django==2.0.06
easy-thumbnails==2.5
Pillow==5.1.0
python-dateutil==2.6.1
pytz==2018.3
redis==2.10.6
reportlab==3.4.0
......@@ -4,10 +4,10 @@
-e ../login
-e ../mail
-e ../report
black
factory-boy
psycopg2
pytest-cov
pytest-django
pytest-flakes
pytest-pep8
pytest-sugar
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment