From 58a23fed13a63de9d45f04e25d485b99af01a3a8 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Tue, 13 Oct 2020 13:01:18 -0600 Subject: [PATCH] Check user is authenticated and usersettings_helpdesk model is created before attempting to read a tickets_per_page, otherwise use default value --- helpdesk/views/staff.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/helpdesk/views/staff.py b/helpdesk/views/staff.py index 7c474019..6a028ec9 100644 --- a/helpdesk/views/staff.py +++ b/helpdesk/views/staff.py @@ -99,7 +99,10 @@ def dashboard(request): with options for them to 'Take' ownership of said tickets. """ # user settings num tickets per page - tickets_per_page = request.user.usersettings_helpdesk.tickets_per_page or 25 + if request.user.is_authenticated and hasattr(request.user, 'usersettings_helpdesk'): + tickets_per_page = request.user.usersettings_helpdesk.tickets_per_page + else: + tickets_per_page = 25 # page vars for the three ticket tables user_tickets_page = request.GET.get(_('ut_page'), 1)