mirror of
https://github.com/ansible/awx.git
synced 2026-01-17 04:31:21 -03:30
Work around a bug in django 1.4 and 1.5 for qsstats that would not allow
it to work with USE_TZ = True
This commit is contained in:
parent
1a7f3d17d6
commit
1590ce1762
@ -257,10 +257,6 @@ class DashboardGraphView(APIView):
|
||||
period = request.QUERY_PARAMS.get('period', 'month')
|
||||
job_type = request.QUERY_PARAMS.get('job_type', 'all')
|
||||
|
||||
# Working around a django 1.5 bug:
|
||||
# https://code.djangoproject.com/ticket/17260
|
||||
settings.USE_TZ = False
|
||||
|
||||
qs = User.objects.all()
|
||||
user_unified_jobs = get_user_queryset(request.user, UnifiedJob)
|
||||
user_hosts = get_user_queryset(request.user, Host)
|
||||
@ -322,9 +318,6 @@ class DashboardGraphView(APIView):
|
||||
this_inventory['sources'].append(this_source)
|
||||
dashboard_data['inventory'].append(this_inventory)
|
||||
|
||||
# Setting it back
|
||||
settings.USE_TZ = True
|
||||
|
||||
return Response(dashboard_data)
|
||||
|
||||
class ScheduleList(ListAPIView):
|
||||
|
||||
@ -122,6 +122,12 @@ class QuerySetStats(object):
|
||||
|
||||
stat_list = []
|
||||
dt = start
|
||||
try:
|
||||
from django.utils.timezone import utc
|
||||
dt = dt.replace(tzinfo=utc)
|
||||
end = end.replace(tzinfo=utc)
|
||||
except ImportError:
|
||||
pass
|
||||
while dt < end:
|
||||
idx = 0
|
||||
value = 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user