From 2b6c23db9f85d86e53968e60f68098aa5fd39892 Mon Sep 17 00:00:00 2001 From: Pawel M Date: Tue, 1 Mar 2016 22:53:33 +0100 Subject: [PATCH] (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')\n GROUP BY queue, name\n ORDER BY q.id' at line 9") helpdesk/views/staff.py in dashboard 149 solved. When queues is null do not add to sql q.id in () --- helpdesk/views/staff.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/helpdesk/views/staff.py b/helpdesk/views/staff.py index 2a00f090..5b592d05 100644 --- a/helpdesk/views/staff.py +++ b/helpdesk/views/staff.py @@ -132,8 +132,11 @@ def dashboard(request): from_clause = """FROM helpdesk_ticket t, helpdesk_queue q""" - where_clause = """WHERE q.id = t.queue_id AND - q.id IN (%s)""" % (",".join(("%d" % pk for pk in queues))) + if queues: + where_clause = """WHERE q.id = t.queue_id AND + q.id IN (%s)""" % (",".join(("%d" % pk for pk in queues))) + else: + where_clause = """WHERE q.id = t.queue_id""" cursor = connection.cursor() cursor.execute("""