IPAM prefixes list view throwing AttributeError #3176

Closed
opened 2025-12-29 18:26:21 +01:00 by adam · 3 comments
Owner

Originally created by @ktims on GitHub (Jan 17, 2020).

Originally assigned to: @jeremystretch on GitHub.

Environment

  • Python version: 3.6.7
  • NetBox version: 2.7.0

Steps to Reproduce

  1. Visit /ipam/prefixes

Template to be rendered normally.

<class 'AttributeError'>

'IPAddress' object has no attribute 'ip'

The full backtrace from the log is here.

Originally created by @ktims on GitHub (Jan 17, 2020). Originally assigned to: @jeremystretch on GitHub. ### Environment * Python version: 3.6.7 * NetBox version: 2.7.0 ### Steps to Reproduce 1. Visit /ipam/prefixes <!-- What did you expect to happen? --> Template to be rendered normally. <!-- What happened instead? --> > <class 'AttributeError'> > > 'IPAddress' object has no attribute 'ip' The full backtrace from the log is [here](https://github.com/netbox-community/netbox/files/4074687/netbox-backtrace-2020-01-16.txt).
adam added the type: bugstatus: accepted labels 2025-12-29 18:26:21 +01:00
adam closed this issue 2025-12-29 18:26:21 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jan 17, 2020):

This is a regression introduced by changes to BaseIPField in #3525. Working on a fix.

@jeremystretch commented on GitHub (Jan 17, 2020): This is a regression introduced by changes to `BaseIPField` in #3525. Working on a fix.
Author
Owner

@jeremystretch commented on GitHub (Jan 17, 2020):

Also need to extend our tests to catch errors like this.

@jeremystretch commented on GitHub (Jan 17, 2020): Also need to extend our tests to catch errors like this.
Author
Owner

@ktims commented on GitHub (Jan 17, 2020):

Another instance found on /ipam/ip-addresses/

Traceback (most recent call last):
  File "/srv/netbox/.env/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/srv/netbox/.env/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/srv/netbox/.env/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/srv/netbox/.env/lib/python3.6/site-packages/django/views/generic/base.py", line 71, in view
    return self.dispatch(request, *args, **kwargs)
  File "/srv/netbox/.env/lib/python3.6/site-packages/django/contrib/auth/mixins.py", line 85, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/srv/netbox/.env/lib/python3.6/site-packages/django/views/generic/base.py", line 97, in dispatch
    return handler(request, *args, **kwargs)
  File "/srv/netbox/netbox/ipam/views.py", line 661, in get
    vrf=ipaddress.vrf, prefix__net_contains=str(ipaddress.address.ip)
AttributeError: 'IPAddress' object has no attribute 'ip'

I was about to submit a PR for these two, but it's trivial and looks like you're on it.

@ktims commented on GitHub (Jan 17, 2020): Another instance found on /ipam/ip-addresses/<ip> ```Internal Server Error: /ipam/ip-addresses/2012/ Traceback (most recent call last): File "/srv/netbox/.env/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner response = get_response(request) File "/srv/netbox/.env/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response response = self.process_exception_by_middleware(e, request) File "/srv/netbox/.env/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/srv/netbox/.env/lib/python3.6/site-packages/django/views/generic/base.py", line 71, in view return self.dispatch(request, *args, **kwargs) File "/srv/netbox/.env/lib/python3.6/site-packages/django/contrib/auth/mixins.py", line 85, in dispatch return super().dispatch(request, *args, **kwargs) File "/srv/netbox/.env/lib/python3.6/site-packages/django/views/generic/base.py", line 97, in dispatch return handler(request, *args, **kwargs) File "/srv/netbox/netbox/ipam/views.py", line 661, in get vrf=ipaddress.vrf, prefix__net_contains=str(ipaddress.address.ip) AttributeError: 'IPAddress' object has no attribute 'ip' ``` I was about to submit a PR for these two, but it's trivial and looks like you're on it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3176