Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Django to 3.2 #1323

Merged
merged 11 commits into from
Aug 19, 2021
4 changes: 2 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ verify_ssl = true
name = "pypi"

[packages]
django = "~=2.2"
django = "~=3.2"
dj-database-url = "*"
gevent = "*"
gunicorn = "*"
whitenoise = "*"
djangorestframework = "~=3.8"
djangorestframework = "~=3.12"
djangorestframework-csv = "*"
bleach = "*"
newrelic = "*"
Expand Down
133 changes: 73 additions & 60 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,25 @@
#

-i https://pypi.python.org/simple
asgiref==3.4.1; python_version >= '3.6'
beautifulsoup4==4.9.3
bleach==3.3.1
bleach==4.0.0
certifi==2021.5.30
cfenv==0.5.3
cg-django-uaa==2.1.1
cg-django-uaa==2.1.3
charset-normalizer==2.0.4; python_version >= '3'
dj-database-url==0.5.0
django-webtest==1.9.7
django==3.1.13
django==3.2.6
djangorestframework-csv==2.1.1
djangorestframework==3.12.4
furl==2.1.2
gevent==21.1.2
greenlet==1.1.0; platform_python_implementation == 'CPython'
gevent==21.8.0
greenlet==1.1.1; platform_python_implementation == 'CPython'
gunicorn==20.1.0
idna==3.2; python_version >= '3'
markdown==3.3.4
newrelic==6.6.0.162
newrelic==6.8.0.163
numpy==1.21.1; python_version >= '3.7'
orderedmultidict==1.0.1
packaging==21.0; python_version >= '3.6'
Expand Down
1 change: 1 addition & 0 deletions tock/employees/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

class EmployeesAppConfig(AppConfig):
name = "employees"
default_auto_field = 'django.db.models.AutoField'

def ready(self):
setup_signals()
1 change: 1 addition & 0 deletions tock/hours/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

class HoursAppConfig(AppConfig):
name = "hours"
default_auto_field = 'django.db.models.AutoField'

def ready(self):
setup_signals()
6 changes: 3 additions & 3 deletions tock/hours/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,9 @@ def calculate_hours(self):
excluded_filter = Q(timecardobjects__project__exclude_from_billability=True)

# Using Coalesce to set a default value of 0 if no data is available
billable = Coalesce(Sum('timecardobjects__hours_spent', filter=billable_filter), 0)
non_billable = Coalesce(Sum('timecardobjects__hours_spent', filter=non_billable_filter), 0)
excluded = Coalesce(Sum('timecardobjects__hours_spent', filter=excluded_filter), 0)
billable = Coalesce(Sum('timecardobjects__hours_spent', filter=billable_filter), Decimal('0'))
non_billable = Coalesce(Sum('timecardobjects__hours_spent', filter=non_billable_filter), Decimal('0'))
excluded = Coalesce(Sum('timecardobjects__hours_spent', filter=excluded_filter), Decimal('0'))


timecard = Timecard.objects.filter(id=self.id).annotate(billable=billable).annotate(non_billable=non_billable).annotate(excluded=excluded)[0]
Expand Down
1 change: 1 addition & 0 deletions tock/organizations/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

class OrganizationsAppConfig(AppConfig):
name = "organizations"
default_auto_field = 'django.db.models.AutoField'

def ready(self):
setup_signals()
1 change: 1 addition & 0 deletions tock/projects/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

class ProjectsAppConfig(AppConfig):
name = "projects"
default_auto_field = 'django.db.models.AutoField'

def ready(self):
setup_signals()
5 changes: 3 additions & 2 deletions tock/utilization/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import datetime
from decimal import Decimal

from hours.models import ReportingPeriod
from django.db.models import Q, Sum
Expand Down Expand Up @@ -41,8 +42,8 @@ def _build_utilization_query(users=None,recent_periods=None, fiscal_year=False,
filter_ = Q(filter_, Q(timecards__submitted=True, timecards__unit=unit))

# Using Coalesce to set a default value of 0 if no data is available
billable = Coalesce(Sum('timecards__billable_hours', filter=filter_), 0)
non_billable = Coalesce(Sum('timecards__non_billable_hours', filter=filter_), 0)
billable = Coalesce(Sum('timecards__billable_hours', filter=filter_), Decimal('0'))
non_billable = Coalesce(Sum('timecards__non_billable_hours', filter=filter_), Decimal('0'))
target_billable = Sum('timecards__target_hours', filter=filter_)
if users:
return users.annotate(billable=billable).annotate(target=target_billable).annotate(total=billable + non_billable)
Expand Down