|
@@ -77,13 +77,13 @@ class ActiveServiceManager(models.Manager):
|
|
|
def get_queryset(self):
|
|
|
qs = super().get_queryset()
|
|
|
qs = qs.annotate(
|
|
|
- has_active_allocation=models.Case(
|
|
|
+ has_active_allocations=models.Case(
|
|
|
models.When(get_active_filter('allocation'), then=True),
|
|
|
default=False,
|
|
|
output_field=models.BooleanField()
|
|
|
)
|
|
|
)
|
|
|
- qs = qs.order_by('pk', '-has_active_allocation').distinct() # complicated things here, do not touch if you're not sure
|
|
|
+ qs = qs.order_by('pk', '-has_active_allocations').distinct() # complicated things here, do not touch if you're not sure
|
|
|
return qs
|
|
|
|
|
|
|
|
@@ -155,7 +155,7 @@ class Service(models.Model):
|
|
|
raise ValidationError("Un service du même type existe déjà avec ce label.")
|
|
|
|
|
|
def is_active(self):
|
|
|
- return self.has_active_allocation
|
|
|
+ return self.has_active_allocations
|
|
|
is_active.boolean = True
|
|
|
is_active.short_description = 'Actif'
|
|
|
|