[PR #17234] [MERGED] Fixes: #17070 - Make image_width and image_height read_only on REST API ImageAttachmentSerializer #15030

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/17234
Author: @bctiemann
Created: 8/21/2024
Status: Merged
Merged: 8/22/2024
Merged by: @jeremystretch

Base: developHead: 17070-rest-api-make-image-width-height-read-only


📝 Commits (1)

  • 8d5439a Set ImageAttachmentSerializer.image_width and image_height to read_only

📊 Changes

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

View changed files

📝 netbox/extras/api/serializers_/attachments.py (+2 -0)

📄 Description

Fixes: #17070 - Make image_width and image_height read_only on REST API ImageAttachmentSerializer

Sets the image_width and image_height fields on ImageAttachmentSerializer to read_only. This prevents redundant and cumbersome "field required" errors when submitting an Image Attachment via the REST API.

Tested to verify that submitting an image via the API without these fields in the payload is still handled correctly via Django and the fields are automatically populated.


🔄 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/17234 **Author:** [@bctiemann](https://github.com/bctiemann) **Created:** 8/21/2024 **Status:** ✅ Merged **Merged:** 8/22/2024 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `17070-rest-api-make-image-width-height-read-only` --- ### 📝 Commits (1) - [`8d5439a`](https://github.com/netbox-community/netbox/commit/8d5439af5bb3ed34af18bf7f94b3cbcd655ffd70) Set ImageAttachmentSerializer.image_width and image_height to read_only ### 📊 Changes **1 file changed** (+2 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `netbox/extras/api/serializers_/attachments.py` (+2 -0) </details> ### 📄 Description ### Fixes: #17070 - Make image_width and image_height read_only on REST API ImageAttachmentSerializer Sets the `image_width` and `image_height` fields on `ImageAttachmentSerializer` to read_only. This prevents redundant and cumbersome "field required" errors when submitting an Image Attachment via the REST API. Tested to verify that submitting an image via the API without these fields in the payload is still handled correctly via Django and the fields are automatically populated. --- <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:19:32 +01:00
adam closed this issue 2025-12-30 00:19:33 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15030