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

Exception thrown when deleting Software Version or Image from list views #5669

Closed
Dav-C opened this issue May 3, 2024 · 1 comment · Fixed by #5739
Closed

Exception thrown when deleting Software Version or Image from list views #5669

Dav-C opened this issue May 3, 2024 · 1 comment · Fixed by #5739
Assignees
Labels
type: bug Something isn't working as expected

Comments

@Dav-C
Copy link
Contributor

Dav-C commented May 3, 2024

Environment

  • Nautobot version (Docker tag too if applicable): 2.2.3
  • Python version: 3.11
  • Database platform, version: PostgreSQL
  • Middleware(s):

Steps to Reproduce

  1. Create a Software Version object
  2. Create a Software Image File object and associate it with the Software Version object.
  3. Associate a device with the new software and image objects
  4. Delete either of the new objects using bulk delete from their respective list views.

Expected Behavior

An warning should be displayed because of the protected relationships.

Observed Behavior

AttributeError and traceback

@Dav-C Dav-C added type: bug Something isn't working as expected triage This issue is new and has not been reviewed. labels May 3, 2024
@timizuoebideri1 timizuoebideri1 removed the triage This issue is new and has not been reviewed. label May 7, 2024
@timizuoebideri1
Copy link
Contributor

The error is raised in handle_protectederror when trying to get the absolute_url of a model that do not have a view I.e DeviceTypeToSoftwareImageFile

def handle_protectederror(obj_list, request, e):
    ...

    err_message += format_html_join(
        ", ",
        '<a href="{}">{}</a>',
        ((dependent.get_absolute_url(), dependent) for dependent in protected_objects[:50]),
    )
    ...

A view for this model could be added or we skip attaching href to models without to an absolute_url

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working as expected
Projects
None yet
3 participants