diff --git a/pyBuchaktion/admin.py b/pyBuchaktion/admin.py index c4d36ad..41286bd 100644 --- a/pyBuchaktion/admin.py +++ b/pyBuchaktion/admin.py @@ -449,6 +449,7 @@ class OrderTimeframeAdmin(ModelAdmin): 'end_date', 'start_date', 'semester', + 'student_count', ) form = OrderTimeframeForm diff --git a/pyBuchaktion/models.py b/pyBuchaktion/models.py index 20e5111..f3f127f 100644 --- a/pyBuchaktion/models.py +++ b/pyBuchaktion/models.py @@ -403,6 +403,9 @@ def __str__(self): def natural_key(self): return { "from": self.start_date, "to": self.end_date } + def student_count(self): + return self.order_set.values('student').distinct().count() + # Set the singular and plural names for i18n class Meta: verbose_name = _("order timeframe")