[PR #5361] [MERGED] #5305: Optimize ObjectView to minimize view boilerplate #13009

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/5361
Author: @jeremystretch
Created: 11/19/2020
Status: Merged
Merged: 11/19/2020
Merged by: @jeremystretch

Base: develop-2.10Head: 5305-standardize-object-views


📝 Commits (9)

  • e2d2ff8 Standardize on "object" for ObjectView template context
  • 3e7cf41 Update ObjectChangeLogView to use "object" context var
  • d5d87e0 Update templates to use "object" context var
  • 2f1ca90 Fall back to base template if object template doesn't exist
  • e5caea0 Update UserKey views to use "object" context var
  • 790e1ee Update created_updated.html
  • d237b97 Update custom_fields_panel.html
  • 1d922ee Migrate all ObjectView subclasses to use get_extra_context()
  • 1d7bee5 Move device template

📊 Changes

72 files changed (+1480 additions, -1610 deletions)

View changed files

📝 netbox/circuits/views.py (+11 -14)
📝 netbox/dcim/tables/template_code.py (+26 -26)
📝 netbox/dcim/urls.py (+1 -1)
📝 netbox/dcim/views.py (+134 -196)
📝 netbox/extras/views.py (+34 -54)
📝 netbox/ipam/views.py (+78 -110)
📝 netbox/netbox/views/generic.py (+18 -6)
📝 netbox/secrets/views.py (+0 -8)
📝 netbox/templates/circuits/circuit.html (+30 -30)
📝 netbox/templates/circuits/inc/circuit_termination.html (+7 -7)
📝 netbox/templates/circuits/provider.html (+26 -26)
📝 netbox/templates/dcim/cable.html (+23 -23)
📝 netbox/templates/dcim/cable_trace.html (+1 -1)
📝 netbox/templates/dcim/consoleport.html (+21 -21)
📝 netbox/templates/dcim/consoleserverport.html (+21 -21)
📝 netbox/templates/dcim/device.html (+54 -54)
📝 netbox/templates/dcim/device/base.html (+46 -46)
📝 netbox/templates/dcim/device/config.html (+2 -2)
📝 netbox/templates/dcim/device/consoleports.html (+5 -5)
📝 netbox/templates/dcim/device/consoleserverports.html (+5 -5)

...and 52 more files

📄 Description

Closes #5305

Lots of boilerplate cleanup to make ObjectView subclasses more efficient. Notably, we standardize on the use of object in single-object templates, taking a cue from Django's own generic views.


🔄 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/5361 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 11/19/2020 **Status:** ✅ Merged **Merged:** 11/19/2020 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop-2.10` ← **Head:** `5305-standardize-object-views` --- ### 📝 Commits (9) - [`e2d2ff8`](https://github.com/netbox-community/netbox/commit/e2d2ff85869ccac7d1a92921864b5347c11bfa34) Standardize on "object" for ObjectView template context - [`3e7cf41`](https://github.com/netbox-community/netbox/commit/3e7cf416f16434f9269dab4b28bb4a57a53ac24c) Update ObjectChangeLogView to use "object" context var - [`d5d87e0`](https://github.com/netbox-community/netbox/commit/d5d87e0fdd4a297cea5385432054d54f649cd5a4) Update templates to use "object" context var - [`2f1ca90`](https://github.com/netbox-community/netbox/commit/2f1ca902f769865ea10259a6edcf1ded749cc47f) Fall back to base template if object template doesn't exist - [`e5caea0`](https://github.com/netbox-community/netbox/commit/e5caea04c1ad6a5c7bc5227ebc4be2a9171ae71c) Update UserKey views to use "object" context var - [`790e1ee`](https://github.com/netbox-community/netbox/commit/790e1ee2e4b9d999f3305019d23326ff7f6b422f) Update created_updated.html - [`d237b97`](https://github.com/netbox-community/netbox/commit/d237b97776ecb525df548c5b3a9f328d219fd96e) Update custom_fields_panel.html - [`1d922ee`](https://github.com/netbox-community/netbox/commit/1d922ee8130eb0eda77741088eaee9d0a0fc78dc) Migrate all ObjectView subclasses to use get_extra_context() - [`1d7bee5`](https://github.com/netbox-community/netbox/commit/1d7bee5eeea49ec3b14a173b96f6d3f11fa3df7b) Move device template ### 📊 Changes **72 files changed** (+1480 additions, -1610 deletions) <details> <summary>View changed files</summary> 📝 `netbox/circuits/views.py` (+11 -14) 📝 `netbox/dcim/tables/template_code.py` (+26 -26) 📝 `netbox/dcim/urls.py` (+1 -1) 📝 `netbox/dcim/views.py` (+134 -196) 📝 `netbox/extras/views.py` (+34 -54) 📝 `netbox/ipam/views.py` (+78 -110) 📝 `netbox/netbox/views/generic.py` (+18 -6) 📝 `netbox/secrets/views.py` (+0 -8) 📝 `netbox/templates/circuits/circuit.html` (+30 -30) 📝 `netbox/templates/circuits/inc/circuit_termination.html` (+7 -7) 📝 `netbox/templates/circuits/provider.html` (+26 -26) 📝 `netbox/templates/dcim/cable.html` (+23 -23) 📝 `netbox/templates/dcim/cable_trace.html` (+1 -1) 📝 `netbox/templates/dcim/consoleport.html` (+21 -21) 📝 `netbox/templates/dcim/consoleserverport.html` (+21 -21) 📝 `netbox/templates/dcim/device.html` (+54 -54) 📝 `netbox/templates/dcim/device/base.html` (+46 -46) 📝 `netbox/templates/dcim/device/config.html` (+2 -2) 📝 `netbox/templates/dcim/device/consoleports.html` (+5 -5) 📝 `netbox/templates/dcim/device/consoleserverports.html` (+5 -5) _...and 52 more files_ </details> ### 📄 Description ### Closes #5305 Lots of boilerplate cleanup to make ObjectView subclasses more efficient. Notably, we standardize on the use of `object` in single-object templates, taking a cue from Django's own generic views. --- <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:24:52 +01:00
adam closed this issue 2025-12-29 22:24:52 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#13009