Return 400 if date format is invalid
This commit is contained in:
parent
b87b158aab
commit
ca97453c3e
@ -29,8 +29,12 @@ class DashboardApiView(ApiTokenRequiredMixin, DateRangeMixin, View):
|
|||||||
services = services.filter(uuid=uuid)
|
services = services.filter(uuid=uuid)
|
||||||
|
|
||||||
basic = request.GET.get('basic', '0').lower() in ('1', 'true')
|
basic = request.GET.get('basic', '0').lower() in ('1', 'true')
|
||||||
start = self.get_start_date()
|
try:
|
||||||
end = self.get_end_date()
|
start = self.get_start_date()
|
||||||
|
end = self.get_end_date()
|
||||||
|
except ValueError:
|
||||||
|
return JsonResponse(status=400, data={'error': 'Invalid date format'})
|
||||||
|
|
||||||
services_data = [
|
services_data = [
|
||||||
{
|
{
|
||||||
'name': s.name,
|
'name': s.name,
|
||||||
|
Loading…
Reference in New Issue
Block a user