See #890: expose number of reports linked to tracks, albums, libraries, accounts and artists via the /stats route

This commit is contained in:
Eliot Berriot 2019-09-13 05:53:40 +02:00
parent d4deb830c0
commit 9552b49a46
12 changed files with 73 additions and 2 deletions

View file

@ -73,7 +73,7 @@ class LocalFromFidQuerySet:
return self.filter(~query)
class MutationQuerySet(models.QuerySet):
class GenericTargetQuerySet(models.QuerySet):
def get_for_target(self, target):
content_type = ContentType.objects.get_for_model(target)
return self.filter(target_content_type=content_type, target_id=target.pk)
@ -119,7 +119,7 @@ class Mutation(models.Model):
)
target = GenericForeignKey("target_content_type", "target_id")
objects = MutationQuerySet.as_manager()
objects = GenericTargetQuerySet.as_manager()
def get_federation_id(self):
if self.fid: