Exemplo n.º 1
0
class SourceFilter(FilterSet):
    """Filter for sources by name."""

    name = ListFilter(name='name')

    class Meta:
        """Metadata for filterset."""

        model = Source
        fields = ['name', 'source_type']
Exemplo n.º 2
0
class CredentialFilter(FilterSet):
    """Filter for host credentials by name."""

    name = ListFilter(name='name')

    class Meta:
        """Metadata for filterset."""

        model = Credential
        fields = ['name', 'cred_type']
Exemplo n.º 3
0
class CredentialFilter(FilterSet):
    """Filter for host credentials by name."""

    name = ListFilter(field_name='name')
    search_by_name = CharFilter(field_name='name',
                                lookup_expr='contains',
                                distinct=True)

    class Meta:
        """Metadata for filterset."""

        model = Credential
        fields = ['name', 'cred_type', 'search_by_name']
Exemplo n.º 4
0
class ScanFilter(FilterSet):
    """Filter for sources by name."""

    name = ListFilter(name='name')
    search_by_name = CharFilter(name='name',
                                lookup_expr='contains',
                                distinct=True)
    search_sources_by_name = CharFilter(name='sources__name',
                                        lookup_expr='contains',
                                        distinct=True)

    class Meta:
        """Metadata for filterset."""

        model = Scan
        fields = ['name', 'scan_type',
                  'search_by_name', 'search_sources_by_name']
Exemplo n.º 5
0
class SourceFilter(FilterSet):
    """Filter for sources by name."""

    name = ListFilter(field_name='name')
    search_by_name = CharFilter(field_name='name',
                                lookup_expr='contains',
                                distinct=True)
    search_credentials_by_name = CharFilter(field_name='credentials__name',
                                            lookup_expr='contains',
                                            distinct=True)

    class Meta:
        """Metadata for filterset."""

        model = Source
        fields = ['name', 'source_type',
                  'search_by_name', 'search_credentials_by_name']