From 71ff0aa6d5f76e3581499d9d008e934ee5a360ca Mon Sep 17 00:00:00 2001 From: finnertysea <26181241+finnertysea@users.noreply.github.com> Date: Fri, 20 Jan 2023 10:53:35 -0500 Subject: [PATCH 1/2] Bug fix - detected due date change when no change was made --- helpdesk/views/staff.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/helpdesk/views/staff.py b/helpdesk/views/staff.py index f31b89f6..bf274ad9 100644 --- a/helpdesk/views/staff.py +++ b/helpdesk/views/staff.py @@ -25,6 +25,8 @@ from django.urls import reverse, reverse_lazy from django.utils import timezone from django.utils.html import escape from django.utils.translation import gettext as _ +from django.utils.dateparse import parse_datetime +from django.utils.timezone import make_aware from django.views.decorators.csrf import requires_csrf_token from django.views.generic.edit import FormView, UpdateView from helpdesk import settings as helpdesk_settings @@ -536,12 +538,7 @@ def get_due_date_from_request_or_ticket( due_date = request.POST.get('due_date', None) or None if due_date is not None: - # based on Django code to parse dates: - # https://docs.djangoproject.com/en/2.0/_modules/django/utils/dateparse/ - match = DATE_RE.match(due_date) - if match: - kw = {k: int(v) for k, v in match.groupdict().items()} - due_date = date(**kw) + due_date = make_aware(parse_datetime(due_date)) else: due_date_year = int(request.POST.get('due_date_year', 0)) due_date_month = int(request.POST.get('due_date_month', 0)) From 527918022129859b837090850384c16cdb10969f Mon Sep 17 00:00:00 2001 From: finnertysea <26181241+finnertysea@users.noreply.github.com> Date: Tue, 24 Jan 2023 13:36:18 -0500 Subject: [PATCH 2/2] Bug fix #1066 - modified import order to placate isort --- helpdesk/views/staff.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helpdesk/views/staff.py b/helpdesk/views/staff.py index bf274ad9..3602536d 100644 --- a/helpdesk/views/staff.py +++ b/helpdesk/views/staff.py @@ -23,10 +23,10 @@ from django.http import Http404, HttpResponse, HttpResponseRedirect, JsonRespons from django.shortcuts import get_object_or_404, redirect, render from django.urls import reverse, reverse_lazy from django.utils import timezone -from django.utils.html import escape -from django.utils.translation import gettext as _ from django.utils.dateparse import parse_datetime +from django.utils.html import escape from django.utils.timezone import make_aware +from django.utils.translation import gettext as _ from django.views.decorators.csrf import requires_csrf_token from django.views.generic.edit import FormView, UpdateView from helpdesk import settings as helpdesk_settings