2019-09-18 14:06:46 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
|
|
|
|
from orgs.mixins.api import OrgModelViewSet
|
|
|
|
from assets.models import GatheredUser
|
|
|
|
|
|
|
|
from ..serializers import GatheredUserSerializer
|
2019-09-19 06:48:25 +00:00
|
|
|
from ..filters import AssetRelatedByNodeFilterBackend
|
2019-09-18 14:06:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
__all__ = ['GatheredUserViewSet']
|
|
|
|
|
|
|
|
|
|
|
|
class GatheredUserViewSet(OrgModelViewSet):
|
2019-10-18 07:05:45 +00:00
|
|
|
model = GatheredUser
|
2019-09-18 14:06:46 +00:00
|
|
|
serializer_class = GatheredUserSerializer
|
2019-09-19 06:48:25 +00:00
|
|
|
extra_filter_backends = [AssetRelatedByNodeFilterBackend]
|
2019-09-18 14:06:46 +00:00
|
|
|
|
2021-01-07 02:53:10 +00:00
|
|
|
filterset_fields = ['asset', 'username', 'present', 'asset__ip', 'asset__hostname', 'asset_id']
|
2019-09-18 14:06:46 +00:00
|
|
|
search_fields = ['username', 'asset__ip', 'asset__hostname']
|