Skip to content

Commit

Permalink
catch NotImplementedError and NotSupportedError for missing sqlite di…
Browse files Browse the repository at this point in the history
…stinct feature
  • Loading branch information
jedie committed Aug 21, 2018
1 parent 6466f68 commit c6668cf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions for_runners/admin/gpx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit c6668cf

Please sign in to comment.