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

Fixes #3668: use q to search when assigning IP #3867

Merged
merged 7 commits into from Jan 10, 2020
Merged

Fixes #3668: use q to search when assigning IP #3867

merged 7 commits into from Jan 10, 2020

Conversation

hSaria
Copy link
Contributor

@hSaria hSaria commented Jan 9, 2020

Fixes: #3009

Fixes: #3668

Search by address (starting with), DNS name (icontains), or description (icontains) when assigning an IP address.

@hSaria
Copy link
Contributor Author

hSaria commented Jan 9, 2020

Hold off on this for a bit.

@hSaria hSaria changed the title Fixes #3668: search address by DNS name when assigning Fixes #3668: use q to search when assigning IP Jan 9, 2020
hSaria and others added 2 commits January 9, 2020 16:31
@hSaria
Copy link
Contributor Author

hSaria commented Jan 9, 2020

You can take a look now.

I resolved #3009 in here too. Usually I'd create a separate PR, but then I noticed that the q filter is perfect for both tickets (down to the exact fields' tests).

def search(self, queryset, name, value):
if not value.strip():
return queryset
qs_filter = (
Q(dns_name__icontains=value) |
Q(description__icontains=value) |
Q(address__istartswith=value)

@jeremystretch jeremystretch merged commit fc1245c into netbox-community:develop Jan 10, 2020
@hSaria hSaria deleted the 3668-address-assign-dns-filter branch January 10, 2020 15:09
@lock lock bot locked as resolved and limited conversation to collaborators Apr 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants