diff --git a/committee/models.py b/committee/models.py index 6f9e746..0becbea 100644 --- a/committee/models.py +++ b/committee/models.py @@ -5,7 +5,7 @@ from django.db import models class Committee(models.Model): name = models.CharField(max_length=100, unique=True) - chair = models.ForeignKey(User, null=True) + chair = models.ForeignKey(User, null=True, on_delete=models.CASCADE) def __str__(self): return self.name diff --git a/committee/urls.py b/committee/urls.py index 10e5939..d5cf7ce 100644 --- a/committee/urls.py +++ b/committee/urls.py @@ -1,11 +1,11 @@ -from django.conf.urls import url +from django.urls import path from committee import views urlpatterns = [ - url(r'^$', views.edit, name='edit'), - url(r'^update/(?P\d+)/$', views.update, name='update'), - url(r'^fincom/$', views.add_to_fincom, name='add_to_fincom'), - url(r'^fincom/delete$', views.remove_fincom, name='remove_fincom'), - url(r'^new$', views.new_committee, name='new_committee'), + path('', views.edit, name='edit'), + path('update//', views.update, name='update'), + path('fincom/', views.add_to_fincom, name='add_to_fincom'), + path('fincom/delete', views.remove_fincom, name='remove_fincom'), + path('new', views.new_committee, name='new_committee'), ] diff --git a/fincom/urls.py b/fincom/urls.py index b2684ce..0121290 100644 --- a/fincom/urls.py +++ b/fincom/urls.py @@ -13,16 +13,16 @@ Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ -from django.conf.urls import include, url +from django.urls import include, path from django.contrib import admin from fincom import views urlpatterns = [ - url(r'^$', views.index, name='index'), - url(r'^logout$', views.user_logout, name='logout'), - url(r'^items/', include('items.urls')), - url(r'^committees/', include('committee.urls')), - url('', include('social_django.urls', namespace='social')), - url(r'^admin/', admin.site.urls), + path('', views.index, name='index'), + path('logout', views.user_logout, name='logout'), + path('items/', include('items.urls')), + path('committees/', include('committee.urls')), + path('', include('social_django.urls', namespace='social')), + path('admin/', admin.site.urls), ] diff --git a/fincom/views.py b/fincom/views.py index c521245..202ddcb 100644 --- a/fincom/views.py +++ b/fincom/views.py @@ -3,7 +3,7 @@ from django.contrib.auth import logout from django.template import loader def index(request): - if request.user.is_authenticated(): + if request.user.is_authenticated: return HttpResponseRedirect('/items') template = loader.get_template('fincom/index.html') diff --git a/items/models.py b/items/models.py index 0b9e277..ee81bf4 100644 --- a/items/models.py +++ b/items/models.py @@ -75,7 +75,7 @@ class Item(models.Model): desc = models.CharField(max_length=200) event = models.CharField(max_length=200) - committee = models.ForeignKey(Committee) + committee = models.ForeignKey(Committee, on_delete=models.DO_NOTHING) details = models.TextField() cost = models.DecimalField(max_digits=7, decimal_places=2) date_purchased = models.DateField('date purchased') @@ -84,7 +84,7 @@ class Item(models.Model): variations={'thumbnail': (600, 600)} ) - created_by = models.ForeignKey(User, related_name='created_by') + created_by = models.ForeignKey(User, related_name='created_by', on_delete=models.DO_NOTHING) approved_by = models.ManyToManyField(User, blank=True, related_name='approved_by') date_filed = models.DateTimeField('date filed') status = models.CharField(max_length=2, choices=STATUS) diff --git a/items/urls.py b/items/urls.py index dc32bff..33e080e 100644 --- a/items/urls.py +++ b/items/urls.py @@ -1,12 +1,12 @@ -from django.conf.urls import url +from django.urls import path from items import views urlpatterns = [ - url(r'^$', views.list, name='list'), - url(r'^(?P\d+)/$', views.details, name='details'), - url(r'^(?P\d+)/approve$', views.approve, name='approve'), - url(r'^(?P\d+)/reject$', views.reject, name='reject'), - url(r'^(?P\d+)/edit$', views.edit, name='edit'), - url(r'^(?P\d+)/delete$', views.delete, name='delete'), - url(r'^new$', views.new_form, name='new_form'), + path(r'', views.list, name='list'), + path('/', views.details, name='details'), + path('/approve', views.approve, name='approve'), + path('/reject', views.reject, name='reject'), + path('/edit', views.edit, name='edit'), + path('/delete', views.delete, name='delete'), + path('new', views.new_form, name='new_form'), ] diff --git a/requirements.txt b/requirements.txt index dd31fc7..05cfce5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,31 +1,36 @@ appdirs==1.4.0 -boto3==1.9.28 -botocore==1.12.28 -Django==1.11.16 +boto3==1.9.86 +botocore==1.12.86 +certifi==2018.11.29 +chardet==3.0.4 +defusedxml==0.5.0 +Django==2.1.5 django-cleanup==0.4.2 django-stdimage==2.4.1 django-storages==1.5.2 -docutils==0.13.1 +docutils==0.14 futures==3.0.5 -gunicorn==19.9.0 -jmespath==0.9.1 -oauthlib==2.1.0 +idna==2.8 +jmespath==0.9.3 +oauthlib==3.0.1 olefile==0.44 packaging==16.8 -Pillow==5.3.0 +Pillow==4.0.0 +pkg-resources==0.0.0 progressbar2==3.12.0 psycopg2-binary==2.7.5 -PyJWT==1.4.2 +PyJWT==1.7.1 pyparsing==2.1.10 -python-dateutil==2.6.0 +python-dateutil==2.7.5 python-openid==2.2.5 python-utils==2.0.1 -pytz==2018.5 -requests==2.13.0 -requests-oauthlib==0.7.0 -s3transfer==0.1.10 -six==1.10.0 -social-auth-app-django==2.1.0 -social-auth-core==1.7.0 -urllib3==1.23 +python3-openid==3.1.0 +pytz==2018.9 +requests==2.21.0 +requests-oauthlib==1.2.0 +s3transfer==0.1.13 +six==1.12.0 +social-auth-app-django==3.1.0 +social-auth-core==3.0.0 +urllib3==1.24.1 whitenoise==3.3.0