Textual evaluation filters don't work for IP fields #1329

Closed
opened 2025-12-29 16:31:30 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Oct 18, 2017).

Issue type

[ ] Feature request
[x] Bug report
[ ] Documentation

Environment

  • Python version: 3.4.3
  • NetBox version: 2.2.2

Description

Text-based search filters (startswith, endswith, regex, and their case-insensitive counterparts) are not properly evaluated for IPNetworkFields and IPAddressFields:

>>> from netaddr import IPNetwork
>>> IPAddress(address=IPNetwork('192.0.2.1/24')).save()
>>> IPAddress(address=IPNetwork('192.0.2.2/24')).save()
>>> IPAddress(address=IPNetwork('192.0.2.3/24')).save()
>>> IPAddress.objects.filter(address__startswith='192.0.2')
<QuerySet []>
Originally created by @jeremystretch on GitHub (Oct 18, 2017). ### Issue type [ ] Feature request <!-- Requesting the implementation of a new feature --> [x] Bug report <!-- Reporting unexpected or erroneous behavior --> [ ] Documentation <!-- Proposing a modification to the documentation --> ### Environment * Python version: 3.4.3 * NetBox version: 2.2.2 ### Description Text-based search filters (`startswith`, `endswith`, `regex`, and their case-insensitive counterparts) are not properly evaluated for IPNetworkFields and IPAddressFields: ``` >>> from netaddr import IPNetwork >>> IPAddress(address=IPNetwork('192.0.2.1/24')).save() >>> IPAddress(address=IPNetwork('192.0.2.2/24')).save() >>> IPAddress(address=IPNetwork('192.0.2.3/24')).save() >>> IPAddress.objects.filter(address__startswith='192.0.2') <QuerySet []> ```
adam added the type: bug label 2025-12-29 16:31:30 +01:00
adam closed this issue 2025-12-29 16:31:30 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1329