membershipworks: Annotate EventExt.meeting_times__count
This commit is contained in:
parent
8498d311d5
commit
978024c538
@ -4,7 +4,15 @@ from datetime import datetime
|
||||
import django.core.mail.message
|
||||
from django.conf import settings
|
||||
from django.db import models
|
||||
from django.db.models import Exists, ExpressionWrapper, F, OuterRef, Subquery, Sum
|
||||
from django.db.models import (
|
||||
Count,
|
||||
Exists,
|
||||
ExpressionWrapper,
|
||||
F,
|
||||
OuterRef,
|
||||
Subquery,
|
||||
Sum,
|
||||
)
|
||||
from django.utils import timezone
|
||||
|
||||
|
||||
@ -419,6 +427,7 @@ class EventExtManager(models.Manager["EventExt"]):
|
||||
super()
|
||||
.get_queryset()
|
||||
.annotate(
|
||||
Count("meeting_times"),
|
||||
duration=Subquery(
|
||||
EventMeetingTime.objects.filter(event=OuterRef("pk"))
|
||||
.values("event__pk")
|
||||
|
@ -35,7 +35,7 @@
|
||||
<td>{{ event.category }}</td>
|
||||
<td>{{ event.count }}</td>
|
||||
<td>{{ event.cap }}</td>
|
||||
<td>{{ event.meeting_times.count }}</td>
|
||||
<td>{{ event.meeting_times__count }}</td>
|
||||
<td>{{ event.duration|duration_as_hours }}</td>
|
||||
<td>{{ event.person_hours|duration_as_hours }}</td>
|
||||
</tr>
|
||||
|
Loading…
Reference in New Issue
Block a user