'NoneType' object has no attribute 'pk' #7271

Closed
opened 2025-12-29 20:21:05 +01:00 by adam · 1 comment
Owner

Originally created by @aiv on GitHub (Nov 23, 2022).

NetBox version

v3.3.5

Python version

3.8

Steps to Reproduce

  1. Try to edit ip address assigned to virtual machine with nat on that ip

Expected Behavior

Edit form

Observed Behavior

<class 'AttributeError'>

'NoneType' object has no attribute 'pk'

Python version: 3.8.10
NetBox version: 3.3.5

and in logs:

Internal Server Error: /ipam/ip-addresses/2567/edit/
Traceback (most recent call last):
  File "/opt/netbox-3.3.5/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/opt/netbox-3.3.5/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/netbox-3.3.5/venv/lib/python3.8/site-packages/django/views/generic/base.py", line 84, in view
    return self.dispatch(request, *args, **kwargs)
  File "/opt/netbox/netbox/netbox/views/generic/object_views.py", line 302, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/opt/netbox/netbox/utilities/views.py", line 90, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/opt/netbox-3.3.5/venv/lib/python3.8/site-packages/django/views/generic/base.py", line 119, in dispatch
    return handler(request, *args, **kwargs)
  File "/opt/netbox/netbox/netbox/views/generic/object_views.py", line 353, in get
    form = self.form(instance=obj, initial=initial_data)
  File "/opt/netbox/netbox/ipam/forms/models.py", line 420, in __init__
    initial['nat_cluster'] = nat_inside_parent.virtual_machine.cluster.pk
AttributeError: 'NoneType' object has no attribute 'pk'
Originally created by @aiv on GitHub (Nov 23, 2022). ### NetBox version v3.3.5 ### Python version 3.8 ### Steps to Reproduce 1. Try to edit ip address assigned to virtual machine with nat on that ip ### Expected Behavior Edit form ### Observed Behavior ``` <class 'AttributeError'> 'NoneType' object has no attribute 'pk' Python version: 3.8.10 NetBox version: 3.3.5 ``` and in logs: ``` Internal Server Error: /ipam/ip-addresses/2567/edit/ Traceback (most recent call last): File "/opt/netbox-3.3.5/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) File "/opt/netbox-3.3.5/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/opt/netbox-3.3.5/venv/lib/python3.8/site-packages/django/views/generic/base.py", line 84, in view return self.dispatch(request, *args, **kwargs) File "/opt/netbox/netbox/netbox/views/generic/object_views.py", line 302, in dispatch return super().dispatch(request, *args, **kwargs) File "/opt/netbox/netbox/utilities/views.py", line 90, in dispatch return super().dispatch(request, *args, **kwargs) File "/opt/netbox-3.3.5/venv/lib/python3.8/site-packages/django/views/generic/base.py", line 119, in dispatch return handler(request, *args, **kwargs) File "/opt/netbox/netbox/netbox/views/generic/object_views.py", line 353, in get form = self.form(instance=obj, initial=initial_data) File "/opt/netbox/netbox/ipam/forms/models.py", line 420, in __init__ initial['nat_cluster'] = nat_inside_parent.virtual_machine.cluster.pk AttributeError: 'NoneType' object has no attribute 'pk' ```
adam added the type: bug label 2025-12-29 20:21:05 +01:00
adam closed this issue 2025-12-29 20:21:05 +01:00
Author
Owner

@kkthxbye-code commented on GitHub (Nov 23, 2022):

Duplicate of https://github.com/netbox-community/netbox/issues/10997

@kkthxbye-code commented on GitHub (Nov 23, 2022): Duplicate of https://github.com/netbox-community/netbox/issues/10997
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7271