diff --git a/.envs/.local/.django b/.envs/.local/.django index 2351d52f9..8e1cf358c 100644 --- a/.envs/.local/.django +++ b/.envs/.local/.django @@ -12,5 +12,3 @@ REDIS_URL=redis://redis:6379/0 # Flower CELERY_FLOWER_USER=QSocnxapfMvzLqJXSsXtnEZqRkBtsmKT CELERY_FLOWER_PASSWORD=BEQgmCtgyrFieKNoGTsux9YIye0I7P5Q7vEgfJD2C4jxmtHDetFaE2jhS7K7rxaf - -SENDGRID_API_KEY="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" diff --git a/ami/main/api/views.py b/ami/main/api/views.py index aa28ca236..273efe3bd 100644 --- a/ami/main/api/views.py +++ b/ami/main/api/views.py @@ -186,7 +186,7 @@ def get_queryset(self) -> QuerySet: # detections_count=models.Count("captures__detections", distinct=True), occurrences_count=models.Count("occurrences", distinct=True), taxa_count=models.Count("occurrences__determination", distinct=True), - ) + ).prefetch_related("occurrences", "occurrences__determination") return qs @@ -608,7 +608,7 @@ def get_queryset(self) -> QuerySet: qs = qs.prefetch_related(Prefetch("occurrences", queryset=Occurrence.objects.none())) qs = qs.annotate( occurrences_count=models.Value(0), - events_count=models.Value(0), + # events_count=models.Value(0), last_detected=models.Value(None, output_field=models.DateTimeField()), )