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

Error switching cable Type #15973

Closed
arthanson opened this issue May 6, 2024 · 3 comments · Fixed by #16049
Closed

Error switching cable Type #15973

arthanson opened this issue May 6, 2024 · 3 comments · Fixed by #16049
Assignees
Labels
severity: medium Results in substantial degraded or broken functionality for specfic workflows status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@arthanson
Copy link
Collaborator

Deployment Type

Self-hosted

NetBox Version

v4.0.0-beta2

Python Version

3.8

Steps to Reproduce

  1. Create a cable connecting some devices
  2. Edit the cable and change the A side or B side Type in the dropdown

Expected Behavior

You should be able to change the cable type.

Observed Behavior

Potentially related to #15783, but doing the same as above on NetBox v3.7.8 does not reproduce the error, only seems to happen in beta.

Traceback (most recent call last):
  File "/Users/ahanson/dev/work/netbox/venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/Users/ahanson/dev/work/netbox/venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Users/ahanson/dev/work/netbox/venv/lib/python3.10/site-packages/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
  File "/Users/ahanson/dev/work/netbox/netbox/netbox/views/generic/object_views.py", line 176, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/Users/ahanson/dev/work/netbox/netbox/netbox/views/generic/base.py", line 26, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/Users/ahanson/dev/work/netbox/netbox/utilities/views.py", line 108, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/Users/ahanson/dev/work/netbox/venv/lib/python3.10/site-packages/django/views/generic/base.py", line 143, in dispatch
    return handler(request, *args, **kwargs)
  File "/Users/ahanson/dev/work/netbox/netbox/netbox/views/generic/object_views.py", line 232, in get
    return render(request, self.htmx_template_name, {
  File "/Users/ahanson/dev/work/netbox/venv/lib/python3.10/site-packages/django/shortcuts.py", line 25, in render
    content = loader.render_to_string(template_name, context, request, using=using)
  File "/Users/ahanson/dev/work/netbox/venv/lib/python3.10/site-packages/django/template/loader.py", line 62, in render_to_string
    return template.render(context, request)
  File "/Users/ahanson/dev/work/netbox/venv/lib/python3.10/site-packages/django/template/backends/django.py", line 61, in render
    return self.template.render(context)
  File "/Users/ahanson/dev/work/netbox/venv/lib/python3.10/site-packages/django/template/base.py", line 171, in render
    return self._render(context)
  File "/Users/ahanson/dev/work/netbox/venv/lib/python3.10/site-packages/django/test/utils.py", line 111, in instrumented_test_render
    return self.nodelist.render(context)
  File "/Users/ahanson/dev/work/netbox/venv/lib/python3.10/site-packages/django/template/base.py", line 1000, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/Users/ahanson/dev/work/netbox/venv/lib/python3.10/site-packages/django/template/base.py", line 1000, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/Users/ahanson/dev/work/netbox/venv/lib/python3.10/site-packages/django/template/base.py", line 961, in render_annotated
    return self.render(context)
  File "/Users/ahanson/dev/work/netbox/venv/lib/python3.10/site-packages/django/template/defaulttags.py", line 326, in render
    return nodelist.render(context)
  File "/Users/ahanson/dev/work/netbox/venv/lib/python3.10/site-packages/django/template/base.py", line 1000, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/Users/ahanson/dev/work/netbox/venv/lib/python3.10/site-packages/django/template/base.py", line 1000, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "/Users/ahanson/dev/work/netbox/venv/lib/python3.10/site-packages/django/template/base.py", line 961, in render_annotated
    return self.render(context)
  File "/Users/ahanson/dev/work/netbox/venv/lib/python3.10/site-packages/django/template/library.py", line 258, in render
    _dict = self.func(*resolved_args, **resolved_kwargs)
  File "/Users/ahanson/dev/work/netbox/netbox/utilities/templatetags/form_helpers.py", line 125, in render_field
    'label': label or field.label,
AttributeError: 'str' object has no attribute 'label'
@arthanson arthanson added type: bug A confirmed report of unexpected behavior in the application beta Concerns a bug/feature in a beta release status: needs triage This issue is awaiting triage by a maintainer labels May 6, 2024
@jeremystretch jeremystretch removed the beta Concerns a bug/feature in a beta release label May 6, 2024
@arthanson arthanson added status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation severity: medium Results in substantial degraded or broken functionality for specfic workflows and removed status: needs triage This issue is awaiting triage by a maintainer labels May 7, 2024
@arthanson arthanson assigned arthanson and unassigned abhi1693 May 7, 2024
@arthanson arthanson removed the status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation label May 8, 2024
@Julio-Oliveira-Encora
Copy link
Contributor

Could you please assign it to me?

@DanSheps DanSheps added the status: accepted This issue has been accepted for implementation label May 8, 2024
@arthanson
Copy link
Collaborator Author

arthanson commented May 8, 2024

@Julio-Oliveira-Encora actually, I'll take this one.

@Julio-Oliveira-Encora
Copy link
Contributor

No problem. I tested locally.
I solved the issue by replacing line 125 of form_helpers.py with:
'label': label or getattr(field, 'label', None),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity: medium Results in substantial degraded or broken functionality for specfic workflows status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants