From c6668cf678451daf779b7449daf26fc49c4b728d Mon Sep 17 00:00:00 2001 From: JensDiemer Date: Tue, 21 Aug 2018 22:18:56 +0200 Subject: [PATCH] catch NotImplementedError and NotSupportedError for missing sqlite distinct feature --- for_runners/admin/gpx.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/for_runners/admin/gpx.py b/for_runners/admin/gpx.py index a87653c..5a8de0a 100644 --- a/for_runners/admin/gpx.py +++ b/for_runners/admin/gpx.py @@ -13,7 +13,7 @@ from django.conf.urls import url from django.contrib import admin, messages from django.contrib.admin.views.main import ChangeList -from django.db import IntegrityError, models +from django.db import IntegrityError, models, NotSupportedError from django.db.models import Avg, Max, Min from django.http import HttpResponseRedirect from django.template.loader import render_to_string @@ -457,7 +457,7 @@ def __init__(self, *args, **kwargs): try: user_count = qs.distinct("tracked_by").count() - except NotImplementedError: + except (NotImplementedError, NotSupportedError): # e.g.: sqlite has no distinct :( qs = qs.values_list("tracked_by__id", flat=True) user_count = len(set(qs))