Check user is authenticated and usersettings_helpdesk model is created before attempting to read a tickets_per_page, otherwise use default value

This commit is contained in:
Thomas Weber 2020-10-13 13:01:18 -06:00
parent d3cb9fdf23
commit 58a23fed13

View File

@ -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)