[PR #17535] [MERGED] Fixes: #17360 - Ensure model is defined when rendering bulk_edit_button #15116

Closed
opened 2025-12-30 00:20:06 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/17535
Author: @bctiemann
Created: 9/19/2024
Status: Merged
Merged: 9/26/2024
Merged by: @jeremystretch

Base: developHead: 17360-htmx-fix-empty-model


📝 Commits (4)

  • a6634a2 Ensure model is defined when rendering bulk_edit_button
  • 8940732 Move model check to inner conditional
  • 485d3ae Set model in context
  • c5966be Return child_model instead of model for use in bulk_edit_button

📊 Changes

1 file changed (+2 additions, -0 deletions)

View changed files

📝 netbox/netbox/views/generic/object_views.py (+2 -0)

📄 Description

Fixes: #17360

Addresses a common issue in HTMX navigation where the inclusion of a call to bulk_edit_button where the param model is a string raises an AttributeError: 'str' object has no attribute '_meta'.

This fix adds a check for truthiness of model before trying to render {% bulk_edit_button %} or {% bulk_delete_button %} in table.py.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/17535 **Author:** [@bctiemann](https://github.com/bctiemann) **Created:** 9/19/2024 **Status:** ✅ Merged **Merged:** 9/26/2024 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `17360-htmx-fix-empty-model` --- ### 📝 Commits (4) - [`a6634a2`](https://github.com/netbox-community/netbox/commit/a6634a2c8e586f69d6f5b2ff39cce503487d1168) Ensure model is defined when rendering bulk_edit_button - [`8940732`](https://github.com/netbox-community/netbox/commit/8940732a86d8e68e60f7606309da286182513e2d) Move model check to inner conditional - [`485d3ae`](https://github.com/netbox-community/netbox/commit/485d3aee3757547b864f733f01fb3c2fc174e8e2) Set model in context - [`c5966be`](https://github.com/netbox-community/netbox/commit/c5966be13b747bbe5e8b4bddb857971362dfee2a) Return child_model instead of model for use in bulk_edit_button ### 📊 Changes **1 file changed** (+2 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `netbox/netbox/views/generic/object_views.py` (+2 -0) </details> ### 📄 Description ### Fixes: #17360 Addresses a common issue in HTMX navigation where the inclusion of a call to `bulk_edit_button` where the param `model` is a string raises an `AttributeError: 'str' object has no attribute '_meta'`. This fix adds a check for truthiness of `model` before trying to render `{% bulk_edit_button %}` or `{% bulk_delete_button %}` in `table.py`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:20:06 +01:00
adam closed this issue 2025-12-30 00:20:06 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15116