diff options
Diffstat (limited to 'models.py')
-rw-r--r-- | models.py | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -31,7 +31,6 @@ class SlugModel(models.Model): super(SlugModel, self).save(*args, **kwargs) - class Meta: abstract = True @@ -106,11 +105,13 @@ class GroupManager(Manager): source=group.source) def get_relevant_groups(self, start, **criteria): - courses = Course.objects.filter(groups=OuterRef("pk"), begin__gte=start) \ + courses = Course.objects.filter(groups=OuterRef("pk"), + begin__gte=start) \ .only("pk")[:1] - return self.get_queryset().annotate(c=Subquery(courses, - output_field=models.IntegerField())) \ - .filter(c__isnull=False, **criteria).order_by("name") + return self.get_queryset() \ + .annotate(c=Subquery(courses, + output_field=models.IntegerField())) \ + .filter(c__isnull=False, **criteria).order_by("name") class Group(SlugModel): |