mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-16 04:02:52 -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)
|
||||
@autotype_decorator(filtersets.ASNFilterSet)
|
||||
class ASNFilter(BaseFilterMixin):
|
||||
pass
|
||||
|
||||
|
||||
# bug - fixme!
|
||||
@strawberry_django.filter(models.ASNRange, lookups=True)
|
||||
@autotype_decorator(filtersets.ASNRangeFilterSet)
|
||||
class ASNRangeFilter(BaseFilterMixin):
|
||||
pass
|
||||
|
||||
|
@ -5,6 +5,7 @@ import django_filters
|
||||
import strawberry
|
||||
import strawberry_django
|
||||
from strawberry import auto
|
||||
from ipam.fields import ASNField
|
||||
from netbox.graphql.scalars import BigInt
|
||||
from utilities.fields import ColorField, CounterCacheField
|
||||
from utilities.filters import *
|
||||
@ -39,7 +40,11 @@ def autotype_decorator(filterset):
|
||||
if isinstance(field, CounterCacheField):
|
||||
create_function = True
|
||||
attr_type = BigInt
|
||||
elif isinstance(field, ASNField):
|
||||
create_function = True
|
||||
attr_type = List[str] | None
|
||||
elif isinstance(field, ColorField):
|
||||
create_function = True
|
||||
attr_type = List[str] | None
|
||||
|
||||
create_attribute_and_function(cls, fieldname, attr_type, create_function)
|
||||
|
@ -127,11 +127,10 @@ class ContactAssignmentFilterSet(NetBoxModelFilterSet):
|
||||
to_field_name='slug',
|
||||
label=_('Contact role (slug)'),
|
||||
)
|
||||
tag = TagFilter()
|
||||
|
||||
class Meta:
|
||||
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):
|
||||
if not value.strip():
|
||||
|
@ -44,7 +44,7 @@ class ContactGroupFilter(BaseFilterMixin):
|
||||
pass
|
||||
|
||||
|
||||
# bug - fixme!
|
||||
@strawberry_django.filter(models.ContactAssignment, lookups=True)
|
||||
@autotype_decorator(filtersets.ContactAssignmentFilterSet)
|
||||
class ContactAssignmentFilter(BaseFilterMixin):
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user