diff --git a/apps/assets/api/account_history.py b/apps/assets/api/account_history.py index 3258dfd48..3feddce91 100644 --- a/apps/assets/api/account_history.py +++ b/apps/assets/api/account_history.py @@ -30,7 +30,11 @@ class AccountHistoryViewSet(AccountViewSet): http_method_names = ['get', 'options'] def get_queryset(self): - queryset = AuthBook.get_queryset(is_history_model=True) + queryset = self.model.objects.all() \ + .annotate(ip=F('asset__ip')) \ + .annotate(hostname=F('asset__hostname')) \ + .annotate(platform=F('asset__platform__name')) \ + .annotate(protocols=F('asset__protocols')) return queryset diff --git a/apps/assets/models/authbook.py b/apps/assets/models/authbook.py index 338c65a3e..a6b52927b 100644 --- a/apps/assets/models/authbook.py +++ b/apps/assets/models/authbook.py @@ -125,9 +125,8 @@ class AuthBook(BaseUser, AbsConnectivity): logger.debug('Update asset admin user: {} {}'.format(self.asset, self.systemuser)) @classmethod - def get_queryset(cls, is_history_model=False): - model = cls.history.model if is_history_model else cls - queryset = model.objects.all() \ + def get_queryset(cls): + queryset = cls.objects.all() \ .annotate(ip=F('asset__ip')) \ .annotate(hostname=F('asset__hostname')) \ .annotate(platform=F('asset__platform__name')) \