[PR #3932] [MERGED] Closes #3892: Robust ContentType filtering #12702

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/3932
Author: @jeremystretch
Created: 1/15/2020
Status: Merged
Merged: 1/15/2020
Merged by: @jeremystretch

Base: develop-2.7Head: 3892-contenttype-filtering


📝 Commits (10+)

  • caf7d02 Remove obsolete constant CABLE_TERMINATION_TYPE_CHOICES
  • 88267e9 Move BGP_ASN_MIN and BGP_ASN_MAX to ipam.constants
  • b98ac64 Fix reference to obsolete constant IFACE_MODE_TAGGED
  • f8dad17 #3892: Convert CABLE_TERMINATION_TYPES to a Q object
  • 9c4ab79 #3892: Convert CUSTOMFIELD_MODELS to a Q object
  • 09bee75 #3892: Convert CUSTOMLINK_MODELS to a Q object
  • f81e7d3 #3892: Convert GRAPH_MODELS to a Q object
  • d9437a0 #3892: Convert EXPORTTEMPLATE_MODELS to a Q object
  • 215b4d0 #3892: Convert WEBHOOK_MODELS to a Q object
  • c28684a Remove obsolete utility function model_names_to_filter_dict()

📊 Changes

18 files changed (+304 additions, -195 deletions)

View changed files

📝 netbox/dcim/api/serializers.py (+2 -2)
📝 netbox/dcim/constants.py (+31 -23)
📝 netbox/dcim/fields.py (+5 -2)
📝 netbox/dcim/forms.py (+5 -8)
netbox/dcim/migrations/0090_cable_termination_models.py (+24 -0)
📝 netbox/dcim/models/__init__.py (+2 -2)
📝 netbox/dcim/tests/test_api.py (+1 -1)
📝 netbox/extras/api/serializers.py (+1 -2)
📝 netbox/extras/constants.py (+162 -107)
📝 netbox/extras/migrations/0022_custom_links.py (+4 -4)
📝 netbox/extras/migrations/0022_custom_links_squashed_0034_configcontext_tags.py (+4 -4)
netbox/extras/migrations/0036_contenttype_filters_to_q_objects.py (+39 -0)
📝 netbox/extras/models.py (+6 -22)
📝 netbox/extras/tests/test_api.py (+1 -2)
📝 netbox/extras/tests/test_filters.py (+5 -2)
📝 netbox/extras/webhooks.py (+4 -3)
📝 netbox/ipam/constants.py (+8 -0)
📝 netbox/utilities/utils.py (+0 -11)

📄 Description

Fixes: #3892

Replaces lists of strings to be mapped to model__in with robust Q() objects which filter fully against both app_name and model.


🔄 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/3932 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 1/15/2020 **Status:** ✅ Merged **Merged:** 1/15/2020 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop-2.7` ← **Head:** `3892-contenttype-filtering` --- ### 📝 Commits (10+) - [`caf7d02`](https://github.com/netbox-community/netbox/commit/caf7d02637be6baa3ce85b53bffcc68f78dd380f) Remove obsolete constant CABLE_TERMINATION_TYPE_CHOICES - [`88267e9`](https://github.com/netbox-community/netbox/commit/88267e9d05be235a17df6f192709cf15d2b66b2a) Move BGP_ASN_MIN and BGP_ASN_MAX to ipam.constants - [`b98ac64`](https://github.com/netbox-community/netbox/commit/b98ac64ac2e1160cc79b47bab85b1702fe6cab54) Fix reference to obsolete constant IFACE_MODE_TAGGED - [`f8dad17`](https://github.com/netbox-community/netbox/commit/f8dad1744c37dc1717a94c6d652d4d98d2c5d0f2) #3892: Convert CABLE_TERMINATION_TYPES to a Q object - [`9c4ab79`](https://github.com/netbox-community/netbox/commit/9c4ab79beae3968dbf91de388eaf9bc44cf7a3f8) #3892: Convert CUSTOMFIELD_MODELS to a Q object - [`09bee75`](https://github.com/netbox-community/netbox/commit/09bee75cb36b97e5f0f15b3b0434c46d435f7207) #3892: Convert CUSTOMLINK_MODELS to a Q object - [`f81e7d3`](https://github.com/netbox-community/netbox/commit/f81e7d30e2293d809522b67329a1b8362b8d5b90) #3892: Convert GRAPH_MODELS to a Q object - [`d9437a0`](https://github.com/netbox-community/netbox/commit/d9437a08f0fdcbc1d1a74b3878cf6ba1e4ea312b) #3892: Convert EXPORTTEMPLATE_MODELS to a Q object - [`215b4d0`](https://github.com/netbox-community/netbox/commit/215b4d0b3fae8bd998fbd59b8704d65430173d62) #3892: Convert WEBHOOK_MODELS to a Q object - [`c28684a`](https://github.com/netbox-community/netbox/commit/c28684a8b37bfbd41fc73bfa1f8f0360bd037273) Remove obsolete utility function model_names_to_filter_dict() ### 📊 Changes **18 files changed** (+304 additions, -195 deletions) <details> <summary>View changed files</summary> 📝 `netbox/dcim/api/serializers.py` (+2 -2) 📝 `netbox/dcim/constants.py` (+31 -23) 📝 `netbox/dcim/fields.py` (+5 -2) 📝 `netbox/dcim/forms.py` (+5 -8) ➕ `netbox/dcim/migrations/0090_cable_termination_models.py` (+24 -0) 📝 `netbox/dcim/models/__init__.py` (+2 -2) 📝 `netbox/dcim/tests/test_api.py` (+1 -1) 📝 `netbox/extras/api/serializers.py` (+1 -2) 📝 `netbox/extras/constants.py` (+162 -107) 📝 `netbox/extras/migrations/0022_custom_links.py` (+4 -4) 📝 `netbox/extras/migrations/0022_custom_links_squashed_0034_configcontext_tags.py` (+4 -4) ➕ `netbox/extras/migrations/0036_contenttype_filters_to_q_objects.py` (+39 -0) 📝 `netbox/extras/models.py` (+6 -22) 📝 `netbox/extras/tests/test_api.py` (+1 -2) 📝 `netbox/extras/tests/test_filters.py` (+5 -2) 📝 `netbox/extras/webhooks.py` (+4 -3) 📝 `netbox/ipam/constants.py` (+8 -0) 📝 `netbox/utilities/utils.py` (+0 -11) </details> ### 📄 Description ### Fixes: #3892 Replaces lists of strings to be mapped to `model__in` with robust `Q()` objects which filter fully against both `app_name` and `model`. --- <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-29 22:23:08 +01:00
adam closed this issue 2025-12-29 22:23: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#12702