0
AMAlec Meyer
This code creates a Django Model that counts the number of tasks scheduled for a specific day. It then annotates this model so that it can be searched and filtered.
0 Comments
from django.db.models import Count controls = ConMonControl.objects.annotate( task_count=Count('scheduled_tasks') ).annotate( has_tasks=models.Case( models.When(task_count__gt=0, then=True), default=False, output_field=models.BooleanField() ) )