[PR #18911] [MERGED] Fixes #17443: Adds ExportTemplate.file_name field #15471

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/18911
Author: @jnovinger
Created: 3/14/2025
Status: Merged
Merged: 3/20/2025
Merged by: @jeremystretch

Base: featureHead: 17443-exporttemplate-filename-field


📝 Commits (3)

📊 Changes

17 files changed (+120 additions, -28 deletions)

View changed files

📝 docs/models/extras/exporttemplate.md (+6 -0)
📝 netbox/extras/api/serializers_/exporttemplates.py (+2 -2)
📝 netbox/extras/filtersets.py (+4 -3)
📝 netbox/extras/forms/bulk_edit.py (+5 -1)
📝 netbox/extras/forms/bulk_import.py (+2 -1)
📝 netbox/extras/forms/filtersets.py (+5 -1)
📝 netbox/extras/forms/model_forms.py (+1 -1)
📝 netbox/extras/migrations/0124_alter_tag_options_tag_weight.py (+0 -2)
netbox/extras/migrations/0125_exporttemplate_file_name.py (+16 -0)
📝 netbox/extras/models/models.py (+10 -5)
📝 netbox/extras/tables/tables.py (+4 -3)
📝 netbox/extras/tests/test_api.py (+7 -2)
📝 netbox/extras/tests/test_filtersets.py (+22 -2)
netbox/extras/tests/test_utils.py (+19 -0)
📝 netbox/extras/tests/test_views.py (+6 -5)
📝 netbox/extras/utils.py (+7 -0)
📝 netbox/templates/extras/exporttemplate.html (+4 -0)

📄 Description

Fixes: #17443

  • adds ExportTemplate.file_name field
  • adds logic to ExportTemplate.render_to_response() to use file_name if populated
  • adds field to required places (API serializers, forms, filterset, etc.)
  • updates tests for new field
  • adds a new utils, filename_from_model, to standardize generating export filenames for models
  • adds tests for new util func

🔄 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/18911 **Author:** [@jnovinger](https://github.com/jnovinger) **Created:** 3/14/2025 **Status:** ✅ Merged **Merged:** 3/20/2025 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `feature` ← **Head:** `17443-exporttemplate-filename-field` --- ### 📝 Commits (3) - [`13205ab`](https://github.com/netbox-community/netbox/commit/13205ab9cac15681b526eee5e92ee74c18bcaa8f) Fixes #17443: Adds ExportTemplate.file_name field - [`4e66ede`](https://github.com/netbox-community/netbox/commit/4e66ede35ed87f960353d2abbc1a4a48f620e377) Addresses PR feedback - [`76bf80a`](https://github.com/netbox-community/netbox/commit/76bf80a7eedb3b60ecaae8400995f27c07f5f22e) Fixes migration conflict caused by fix for #17841 ### 📊 Changes **17 files changed** (+120 additions, -28 deletions) <details> <summary>View changed files</summary> 📝 `docs/models/extras/exporttemplate.md` (+6 -0) 📝 `netbox/extras/api/serializers_/exporttemplates.py` (+2 -2) 📝 `netbox/extras/filtersets.py` (+4 -3) 📝 `netbox/extras/forms/bulk_edit.py` (+5 -1) 📝 `netbox/extras/forms/bulk_import.py` (+2 -1) 📝 `netbox/extras/forms/filtersets.py` (+5 -1) 📝 `netbox/extras/forms/model_forms.py` (+1 -1) 📝 `netbox/extras/migrations/0124_alter_tag_options_tag_weight.py` (+0 -2) ➕ `netbox/extras/migrations/0125_exporttemplate_file_name.py` (+16 -0) 📝 `netbox/extras/models/models.py` (+10 -5) 📝 `netbox/extras/tables/tables.py` (+4 -3) 📝 `netbox/extras/tests/test_api.py` (+7 -2) 📝 `netbox/extras/tests/test_filtersets.py` (+22 -2) ➕ `netbox/extras/tests/test_utils.py` (+19 -0) 📝 `netbox/extras/tests/test_views.py` (+6 -5) 📝 `netbox/extras/utils.py` (+7 -0) 📝 `netbox/templates/extras/exporttemplate.html` (+4 -0) </details> ### 📄 Description <!-- Thank you for your interest in contributing to NetBox! Please note that our contribution policy requires that a feature request or bug report be approved and assigned prior to opening a pull request. This helps avoid waste time and effort on a proposed change that we might not be able to accept. IF YOUR PULL REQUEST DOES NOT REFERENCE AN ISSUE WHICH HAS BEEN ASSIGNED TO YOU, IT WILL BE CLOSED AUTOMATICALLY. Please specify your assigned issue number on the line below. --> ### Fixes: #17443 - adds `ExportTemplate.file_name` field - adds logic to `ExportTemplate.render_to_response()` to use `file_name` if populated - adds field to required places (API serializers, forms, filterset, etc.) - updates tests for new field - adds a new utils, `filename_from_model`, to standardize generating export filenames for models - adds tests for new util func <!-- Please include a summary of the proposed changes below. --> --- <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:22:08 +01:00
adam closed this issue 2025-12-30 00:22:08 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15471