mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-27 02:48:38 -06:00
Return null config params for tables with no model
This commit is contained in:
parent
e6b2a03633
commit
ca12f39c1a
@ -193,8 +193,10 @@ class BaseTable(tables.Table):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def config_params(self):
|
def config_params(self):
|
||||||
|
if not (model := getattr(self.Meta, 'model', None)):
|
||||||
|
return None
|
||||||
return urlencode({
|
return urlencode({
|
||||||
'object_type': ObjectType.objects.get_for_model(self.Meta.model).pk,
|
'object_type': ObjectType.objects.get_for_model(model).pk,
|
||||||
'table': self.name,
|
'table': self.name,
|
||||||
**self.configuration,
|
**self.configuration,
|
||||||
})
|
})
|
||||||
|
@ -20,7 +20,9 @@
|
|||||||
<div hx-swap-oob="innerHTML:.total-object-count">{{ table.rows|length }}</div>
|
<div hx-swap-oob="innerHTML:.total-object-count">{{ table.rows|length }}</div>
|
||||||
|
|
||||||
{# Include the updated "save" link for the table configuration #}
|
{# Include the updated "save" link for the table configuration #}
|
||||||
<a class="dropdown-item" hx-swap-oob="outerHTML:#table_save_link" href="{% url 'extras:tableconfig_add' %}?{{ table.config_params }}&return_url={{ request.path }}" id="table_save_link">Save</a>
|
{% if table.config_params %}
|
||||||
|
<a class="dropdown-item" hx-swap-oob="outerHTML:#table_save_link" href="{% url 'extras:tableconfig_add' %}?{{ table.config_params }}&return_url={{ request.path }}" id="table_save_link">Save</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{# Update the bulk action buttons with new query parameters #}
|
{# Update the bulk action buttons with new query parameters #}
|
||||||
{% if actions %}
|
{% if actions %}
|
||||||
|
@ -34,7 +34,9 @@
|
|||||||
<span class="visually-hidden">Toggle Dropdown</span>
|
<span class="visually-hidden">Toggle Dropdown</span>
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="{% url 'extras:tableconfig_add' %}?{{ table.config_params }}&return_url={{ request.path }}" id="table_save_link">Save</a>
|
{% if table.config_params %}
|
||||||
|
<a class="dropdown-item" href="{% url 'extras:tableconfig_add' %}?{{ table.config_params }}&return_url={{ request.path }}" id="table_save_link">Save</a>
|
||||||
|
{% endif %}
|
||||||
{% if table_configs %}
|
{% if table_configs %}
|
||||||
<hr class="dropdown-divider">
|
<hr class="dropdown-divider">
|
||||||
{% for config in table_configs %}
|
{% for config in table_configs %}
|
||||||
|
Loading…
Reference in New Issue
Block a user