[PR #11550] [MERGED] Fixes GenericForeignKey validation #13806

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/11550
Author: @abhi1693
Created: 1/20/2023
Status: Merged
Merged: 4/10/2023
Merged by: @jeremystretch

Base: developHead: fix/10221-fix-gfk-validation


📝 Commits (3)

  • ac81f74 added model validation for GenericForeignKey
  • 5aae5a6 added ct_field and fk_field null validation
  • ee2b4b4 applied suggestion

📊 Changes

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

View changed files

📝 netbox/netbox/models/__init__.py (+28 -0)

📄 Description

Fixes: #10221, #11454

Added a validation on NetBoxModel clean() method for GenericForeignKey fields to ensure that the content type and object ID exist.


🔄 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/11550 **Author:** [@abhi1693](https://github.com/abhi1693) **Created:** 1/20/2023 **Status:** ✅ Merged **Merged:** 4/10/2023 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `fix/10221-fix-gfk-validation` --- ### 📝 Commits (3) - [`ac81f74`](https://github.com/netbox-community/netbox/commit/ac81f741a0cea7dab494a56302df3f99c2bee1a2) added model validation for GenericForeignKey - [`5aae5a6`](https://github.com/netbox-community/netbox/commit/5aae5a68f231ef21b826bd452b14a03c78ca14b7) added ct_field and fk_field null validation - [`ee2b4b4`](https://github.com/netbox-community/netbox/commit/ee2b4b4aacaefb5b0e5fa13f655fc8c3a4a07824) applied suggestion ### 📊 Changes **1 file changed** (+28 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `netbox/netbox/models/__init__.py` (+28 -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: #10221, #11454 <!-- Please include a summary of the proposed changes below. --> Added a validation on `NetBoxModel` `clean()` method for GenericForeignKey fields to ensure that the content type and object ID exist. --- <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 23:20:55 +01:00
adam closed this issue 2025-12-29 23:20:55 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#13806