From 2989de4160fa22959af8f6afbd05f52ca9690850 Mon Sep 17 00:00:00 2001
From: Samuel Gaist <samuel.gaist@idiap.ch>
Date: Thu, 23 Apr 2020 15:29:19 +0200
Subject: [PATCH] [common][utils] annotate_full_name on query rather than
 starting on class

This will allow the use of model managers.
---
 beat/web/common/utils.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/beat/web/common/utils.py b/beat/web/common/utils.py
index 127378d8e..785a93f46 100644
--- a/beat/web/common/utils.py
+++ b/beat/web/common/utils.py
@@ -149,13 +149,13 @@ def py3_cmp(a, b):
     return (a > b) - (a < b)
 
 
-def annotate_full_name(db_class):
+def annotate_full_name(query):
     """
     Annotate a query with the asset full name so that it can be more easily
     filtered.
     """
 
-    return db_class.objects.annotate(
+    return query.annotate(
         full_name=Concat(
             "author__username",
             V("/"),
-- 
GitLab