mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-16 20:22:53 -06:00
9856 fix tenancy, ipam filter definitions
This commit is contained in:
parent
b47c5ee1b8
commit
9c53f76d9e
@ -25,14 +25,15 @@ __all__ = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# bug - fixme!
|
|
||||||
@strawberry_django.filter(models.ASN, lookups=True)
|
@strawberry_django.filter(models.ASN, lookups=True)
|
||||||
|
@autotype_decorator(filtersets.ASNFilterSet)
|
||||||
class ASNFilter(BaseFilterMixin):
|
class ASNFilter(BaseFilterMixin):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
# bug - fixme!
|
# bug - fixme!
|
||||||
@strawberry_django.filter(models.ASNRange, lookups=True)
|
@strawberry_django.filter(models.ASNRange, lookups=True)
|
||||||
|
@autotype_decorator(filtersets.ASNRangeFilterSet)
|
||||||
class ASNRangeFilter(BaseFilterMixin):
|
class ASNRangeFilter(BaseFilterMixin):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import django_filters
|
|||||||
import strawberry
|
import strawberry
|
||||||
import strawberry_django
|
import strawberry_django
|
||||||
from strawberry import auto
|
from strawberry import auto
|
||||||
|
from ipam.fields import ASNField
|
||||||
from netbox.graphql.scalars import BigInt
|
from netbox.graphql.scalars import BigInt
|
||||||
from utilities.fields import ColorField, CounterCacheField
|
from utilities.fields import ColorField, CounterCacheField
|
||||||
from utilities.filters import *
|
from utilities.filters import *
|
||||||
@ -39,7 +40,11 @@ def autotype_decorator(filterset):
|
|||||||
if isinstance(field, CounterCacheField):
|
if isinstance(field, CounterCacheField):
|
||||||
create_function = True
|
create_function = True
|
||||||
attr_type = BigInt
|
attr_type = BigInt
|
||||||
|
elif isinstance(field, ASNField):
|
||||||
|
create_function = True
|
||||||
|
attr_type = List[str] | None
|
||||||
elif isinstance(field, ColorField):
|
elif isinstance(field, ColorField):
|
||||||
|
create_function = True
|
||||||
attr_type = List[str] | None
|
attr_type = List[str] | None
|
||||||
|
|
||||||
create_attribute_and_function(cls, fieldname, attr_type, create_function)
|
create_attribute_and_function(cls, fieldname, attr_type, create_function)
|
||||||
|
@ -127,11 +127,10 @@ class ContactAssignmentFilterSet(NetBoxModelFilterSet):
|
|||||||
to_field_name='slug',
|
to_field_name='slug',
|
||||||
label=_('Contact role (slug)'),
|
label=_('Contact role (slug)'),
|
||||||
)
|
)
|
||||||
tag = TagFilter()
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = ContactAssignment
|
model = ContactAssignment
|
||||||
fields = ('id', 'object_type_id', 'object_id', 'priority', 'tag')
|
fields = ('id', 'object_type_id', 'object_id', 'priority')
|
||||||
|
|
||||||
def search(self, queryset, name, value):
|
def search(self, queryset, name, value):
|
||||||
if not value.strip():
|
if not value.strip():
|
||||||
|
@ -44,7 +44,7 @@ class ContactGroupFilter(BaseFilterMixin):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
# bug - fixme!
|
|
||||||
@strawberry_django.filter(models.ContactAssignment, lookups=True)
|
@strawberry_django.filter(models.ContactAssignment, lookups=True)
|
||||||
|
@autotype_decorator(filtersets.ContactAssignmentFilterSet)
|
||||||
class ContactAssignmentFilter(BaseFilterMixin):
|
class ContactAssignmentFilter(BaseFilterMixin):
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user