Skip to content

Commit

Permalink
Django 2.0 upgrade prep (#839)
Browse files Browse the repository at this point in the history
* Django 2.0 upgrade prep

* Updated pipfile.lock
  • Loading branch information
tbaxter-18f authored Oct 23, 2018
1 parent 57c0743 commit 703507c
Show file tree
Hide file tree
Showing 21 changed files with 312 additions and 310 deletions.
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ django-webtest = "==1.9.2"
[dev-packages]
bandit = "*"
coverage = "*"
django = "==1.11.*"
django-debug-toolbar = "*"
django-webtest = "*"
factory-boy = "*"
Expand Down
544 changes: 269 additions & 275 deletions Pipfile.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tock/api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import json

from django.test import TestCase
from django.core.urlresolvers import reverse
from django.urls import reverse

from django_webtest import WebTest

Expand Down
2 changes: 1 addition & 1 deletion tock/employees/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(primary_key=True, verbose_name='ID', serialize=False, auto_created=True)),
('start_date', models.DateField(null=True, blank=True)),
('end_date', models.DateField(null=True, blank=True)),
('user', models.OneToOneField(to=settings.AUTH_USER_MODEL)),
('user', models.OneToOneField(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)),
],
options={
},
Expand Down
6 changes: 2 additions & 4 deletions tock/employees/migrations/0002_auto_20150429_1851.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
from django.conf import settings
from django.db import models, migrations


class Migration(migrations.Migration):
Expand All @@ -19,7 +17,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID', auto_created=True)),
('start_date', models.DateField(blank=True, null=True)),
('end_date', models.DateField(blank=True, null=True)),
('user', models.OneToOneField(to=settings.AUTH_USER_MODEL)),
('user', models.OneToOneField(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)),
],
options={
},
Expand Down
6 changes: 2 additions & 4 deletions tock/employees/migrations/0003_auto_20150430_1815.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
from django.conf import settings
from django.db import models, migrations


class Migration(migrations.Migration):
Expand All @@ -15,7 +13,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='userdata',
name='user',
field=models.OneToOneField(related_name='user_data', to=settings.AUTH_USER_MODEL),
field=models.OneToOneField(related_name='user_data', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
preserve_default=True,
),
]
7 changes: 6 additions & 1 deletion tock/employees/migrations/0007_auto_20160428_0105.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='userdata',
name='user',
field=models.OneToOneField(verbose_name='Tock username', to=settings.AUTH_USER_MODEL, related_name='user_data'),
field=models.OneToOneField(
verbose_name='Tock username',
to=settings.AUTH_USER_MODEL,
related_name='user_data',
on_delete=models.CASCADE
),
),
]
4 changes: 3 additions & 1 deletion tock/employees/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import datetime

from django.apps import apps
from django.contrib.auth.models import User
from django.contrib.auth import get_user_model
from django.db import models, IntegrityError
from django.db.models import Q

Expand All @@ -11,6 +11,8 @@
from projects.models import ProfitLossAccount


User = get_user_model()

class EmployeeGrade(models.Model):
GRADE_CHOICES = (
(1, '1'),
Expand Down
5 changes: 3 additions & 2 deletions tock/employees/tests/test_views.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from django.core.urlresolvers import reverse
import datetime

from django.urls import reverse

from django_webtest import WebTest

import datetime
from employees.views import parse_date
from employees.models import UserData

Expand Down
2 changes: 1 addition & 1 deletion tock/employees/views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import datetime

from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.views.generic import ListView, DetailView
from django.views.generic.edit import FormView
from rest_framework.permissions import IsAuthenticated
Expand Down
9 changes: 5 additions & 4 deletions tock/hours/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ class Migration(migrations.Migration):
verbose_name='ID',
serialize=False)),
('reporting_period', models.ForeignKey(
to='hours.ReportingPeriod')),],
to='hours.ReportingPeriod',
on_delete=models.CASCADE)),],
options={},
bases=(models.Model,),),
migrations.CreateModel(
Expand All @@ -51,8 +52,8 @@ class Migration(migrations.Migration):
max_digits=3)),
('created', models.DateTimeField(auto_now_add=True)),
('modified', models.DateTimeField(auto_now=True)),
('project', models.ForeignKey(to='projects.Project')),
('timecard', models.ForeignKey(to='hours.Timecard')),],
('project', models.ForeignKey(to='projects.Project', on_delete=models.CASCADE)),
('timecard', models.ForeignKey(to='hours.Timecard', on_delete=models.CASCADE)),],
options={},
bases=(models.Model,),),
migrations.AddField(
Expand All @@ -63,7 +64,7 @@ class Migration(migrations.Migration):
preserve_default=True,),
migrations.AddField(model_name='timecard',
name='user',
field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
field=models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
preserve_default=True,),
migrations.AlterUniqueTogether(
name='timecard',
Expand Down
2 changes: 1 addition & 1 deletion tock/hours/tests/test_integration.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import datetime

from django.core.urlresolvers import reverse
from django.urls import reverse

from django_webtest import WebTest

Expand Down
8 changes: 5 additions & 3 deletions tock/hours/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

from decimal import Decimal

from django.core.urlresolvers import reverse
from django.test import TestCase, RequestFactory
from django.contrib.auth import get_user_model
from django.contrib.auth.models import User
from django.test import TestCase, RequestFactory
from django.urls import reverse

from django_webtest import WebTest

from api.tests import client
Expand All @@ -19,6 +19,8 @@
import hours.views
import projects.models

User = get_user_model()

FIXTURES = [
'tock/fixtures/prod_user.json',
'projects/fixtures/projects.json',
Expand Down
2 changes: 1 addition & 1 deletion tock/hours/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
from django.contrib.auth import get_user_model
from django.core.exceptions import (ObjectDoesNotExist, PermissionDenied,
ValidationError)
from django.core.urlresolvers import reverse
from django.db.models import Sum
from django.http import Http404, HttpResponse
from django.shortcuts import get_object_or_404
from django.urls import reverse
from django.views.generic import DetailView, ListView, TemplateView
from django.views.generic.edit import CreateView, FormView, UpdateView
from rest_framework import serializers
Expand Down
4 changes: 2 additions & 2 deletions tock/projects/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ class Migration(migrations.Migration):
null=True)),
('accounting_code',
models.ForeignKey(verbose_name='Accounting Code',
to='projects.AccountingCode')),],
to='projects.AccountingCode', on_delete=models.CASCADE)),],
options=
{'verbose_name_plural': 'Projects',
'verbose_name': 'Project',},
bases=(models.Model,),),
migrations.AddField(model_name='accountingcode',
name='agency',
field=models.ForeignKey(to='projects.Agency'),
field=models.ForeignKey(to='projects.Agency', on_delete=models.CASCADE),
preserve_default=True,),
]
2 changes: 1 addition & 1 deletion tock/projects/migrations/0013_project_project_lead.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='project',
name='project_lead',
field=models.ForeignKey(to=settings.AUTH_USER_MODEL, null=True),
field=models.ForeignKey(to=settings.AUTH_USER_MODEL, null=True, on_delete=models.CASCADE),
),
]
6 changes: 3 additions & 3 deletions tock/projects/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

from django.conf import settings
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.utils.dateformat import format as date_format
from django_webtest import WebTest
from django.test import TestCase
from django.urls import reverse
from django.utils.dateformat import format as date_format

from django_webtest import WebTest

from hours.models import ReportingPeriod, Timecard, TimecardObject
from projects.views import project_timeline
Expand Down
2 changes: 1 addition & 1 deletion tock/tock/tests/test_middleware.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import time
from django.test import TestCase, override_settings
from django.core.urlresolvers import reverse
from django.urls import reverse

from test_common import ProtectedViewTestCase

Expand Down
2 changes: 1 addition & 1 deletion tock/tock/tests/test_url_auth.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.test import TestCase
from django.core.urlresolvers import RegexURLPattern, RegexURLResolver, reverse
from django.urls import RegexURLPattern, RegexURLResolver, reverse

import tock.urls

Expand Down
4 changes: 2 additions & 2 deletions tock/utilization/tests/test_views.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import datetime

from django.test import TestCase
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.test import TestCase
from django.urls import reverse

from django_webtest import WebTest

Expand Down
2 changes: 1 addition & 1 deletion tock/utilization/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse
from django.template.defaultfilters import slugify
from django.urls import reverse
from django.views.generic import ListView

from hours.models import TimecardObject, ReportingPeriod
Expand Down

0 comments on commit 703507c

Please sign in to comment.