mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-10 18:39:36 -06:00
Fixes #20422: Allow Aggregate and Prefix to filter by family in GraphQL (#20626)
Some checks are pending
CI / build (20.x, 3.10) (push) Waiting to run
CI / build (20.x, 3.11) (push) Waiting to run
CI / build (20.x, 3.12) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, actions) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, python) (push) Waiting to run
Some checks are pending
CI / build (20.x, 3.10) (push) Waiting to run
CI / build (20.x, 3.11) (push) Waiting to run
CI / build (20.x, 3.12) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, actions) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, python) (push) Waiting to run
Co-authored-by: Rinna Izumi <rizumi@bethel.jw.org> Co-authored-by: Jason Novinger <jnovinger@gmail.com>
This commit is contained in:
parent
3d143d635b
commit
9381564cab
@ -101,6 +101,14 @@ class AggregateFilter(ContactFilterMixin, TenancyFilterMixin, PrimaryModelFilter
|
|||||||
q |= Q(**{f"{prefix}prefix__net_contains": query})
|
q |= Q(**{f"{prefix}prefix__net_contains": query})
|
||||||
return q
|
return q
|
||||||
|
|
||||||
|
@strawberry_django.filter_field()
|
||||||
|
def family(
|
||||||
|
self,
|
||||||
|
value: Annotated['IPAddressFamilyEnum', strawberry.lazy('ipam.graphql.enums')],
|
||||||
|
prefix,
|
||||||
|
) -> Q:
|
||||||
|
return Q(**{f"{prefix}prefix__family": value.value})
|
||||||
|
|
||||||
|
|
||||||
@strawberry_django.filter_type(models.FHRPGroup, lookups=True)
|
@strawberry_django.filter_type(models.FHRPGroup, lookups=True)
|
||||||
class FHRPGroupFilter(PrimaryModelFilterMixin):
|
class FHRPGroupFilter(PrimaryModelFilterMixin):
|
||||||
@ -292,6 +300,14 @@ class PrefixFilter(ContactFilterMixin, ScopedFilterMixin, TenancyFilterMixin, Pr
|
|||||||
q |= Q(**{f"{prefix}prefix__net_contains": query})
|
q |= Q(**{f"{prefix}prefix__net_contains": query})
|
||||||
return q
|
return q
|
||||||
|
|
||||||
|
@strawberry_django.filter_field()
|
||||||
|
def family(
|
||||||
|
self,
|
||||||
|
value: Annotated['IPAddressFamilyEnum', strawberry.lazy('ipam.graphql.enums')],
|
||||||
|
prefix,
|
||||||
|
) -> Q:
|
||||||
|
return Q(**{f"{prefix}prefix__family": value.value})
|
||||||
|
|
||||||
|
|
||||||
@strawberry_django.filter_type(models.RIR, lookups=True)
|
@strawberry_django.filter_type(models.RIR, lookups=True)
|
||||||
class RIRFilter(OrganizationalModelFilterMixin):
|
class RIRFilter(OrganizationalModelFilterMixin):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user