Closed abhi1693 closed 1 year ago
IMO the only way it makes sense for us to add a template is if it can be utilized for core views as well. For ObjectChildrenView specifically, templates will typically inherit from a model-specific parent template anyway so I'm not sure how useful this would be.
I think this can be tackled on how I did for ObjectContactView
template. I can provide a PR for this on a similar work and I hope we can simplify most of the templates in use.
I don't see how useful a table would be for a "Tab View", IMO you would use ObjectChildrenView for that as it would likely be a related table or similar.
I think it would make sense if there was a generic view and it consisted of a single left pane which simply loops through all the models meta fields (perhaps have a base call to get_extra_content or similar which populates the attribute fields you want to display.
80% of my plugins use tab view to display related data in a table and all of them ship with the exact code to do this including the template file.
So, the idea was to reduce the code by introducing a boilerplate template which can be used by the core and plugins.
Since, there are cases where a template a template would need to provide extra functionality, we can provide blocks to do so.
I think I missed the part where this was for ObjectChildrenView specifically, the mention of "View Tab" threw me off.
NetBox version
v3.4.7
Feature type
Change to existing functionality
Proposed functionality
Add
view_tab.html
totemplates/inc
with the following minimalistic contentTo allow
table_config
to be passed down to the template, make the following change in the python codeUse case
In a lot of my plugins, wherever I use the
ViewTab
functionality, I have to ship out my own template along with the code. In 99% cases, it's exactly the same file which I even reuse within the same plugin to avoid writing multiple ones for different classes. It would ease with the plugin development, if NetBox provided a generic template that the code will automatically look for if not specified by the plugin developer and use that.Database changes
No response
External dependencies
No response