Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed the filter_address method from IPRangeFilterSet (Issue #269) #289

Merged
merged 2 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/269.removed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removed the filter_address method from IPRangeFilterSet to resolve issues with searching for IPRange objects through the GUI and API.
10 changes: 0 additions & 10 deletions nautobot_firewall_models/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import django_filters
from django.contrib.contenttypes.fields import GenericRelation
from django.core.exceptions import ValidationError
from nautobot.apps.filters import (
MultiValueCharFilter,
NaturalKeyOrPKMultipleChoiceFilter,
Expand Down Expand Up @@ -30,11 +29,9 @@ class IPRangeFilterSet(BaseFilterSet, NautobotFilterSet): # pylint: disable=too
"""Filter for IPRange."""

start_address = MultiValueCharFilter(
method="filter_address",
label="Address",
)
end_address = MultiValueCharFilter(
method="filter_address",
label="Address",
)

Expand All @@ -45,13 +42,6 @@ class Meta:

fields = [i.name for i in model._meta.get_fields() if not isinstance(i, GenericRelation)]

def filter_address(self, queryset, name, value): # pylint: disable=unused-argument
"""Filter method for start & end addresses."""
try:
return queryset.net_in(value)
except ValidationError:
return queryset.none()


class FQDNFilterSet(BaseFilterSet, NautobotFilterSet):
"""Filter for FQDN."""
Expand Down