aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlban Gruin2018-04-03 10:51:19 +0200
committerAlban Gruin2018-04-03 10:51:19 +0200
commit3f2b67605dea039c9498a1c67a89ef6d5443e0a9 (patch)
tree3d7c2bf6aea89f0df51d441842978688bd3d9edb
parent7f575d53d17df6f1e6ade6e0bf6c06049c5a21ef (diff)
On importe ArrayAgg que lorsqu’on utilise une base postgres
-rw-r--r--views.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/views.py b/views.py
index 5ce9816..c3bcdc2 100644
--- a/views.py
+++ b/views.py
@@ -15,7 +15,6 @@
import datetime
-from django.contrib.postgres.aggregates import ArrayAgg
from django.db import connection
from django.db.models import Count, Max
from django.db.models.expressions import RawSQL
@@ -30,6 +29,9 @@ from .utils import get_current_week, get_current_or_next_week, get_week, group_c
import edt
+if connection.vendor == "postgresql":
+ from django.contrib.postgres.aggregates import ArrayAgg
+
def index(request):
years = Year.objects.order_by("name")
return render(request, "index.html", {"elements": years})