diff options
author | Alban Gruin | 2018-04-03 10:51:19 +0200 |
---|---|---|
committer | Alban Gruin | 2018-04-03 10:51:19 +0200 |
commit | 3f2b67605dea039c9498a1c67a89ef6d5443e0a9 (patch) | |
tree | 3d7c2bf6aea89f0df51d441842978688bd3d9edb /views.py | |
parent | 7f575d53d17df6f1e6ade6e0bf6c06049c5a21ef (diff) |
On importe ArrayAgg que lorsqu’on utilise une base postgres
Diffstat (limited to 'views.py')
-rw-r--r-- | views.py | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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}) |