mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-26 18:38: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
|
||||
def config_params(self):
|
||||
if not (model := getattr(self.Meta, 'model', None)):
|
||||
return None
|
||||
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,
|
||||
**self.configuration,
|
||||
})
|
||||
|
@ -20,7 +20,9 @@
|
||||
<div hx-swap-oob="innerHTML:.total-object-count">{{ table.rows|length }}</div>
|
||||
|
||||
{# 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 #}
|
||||
{% if actions %}
|
||||
|
@ -34,7 +34,9 @@
|
||||
<span class="visually-hidden">Toggle Dropdown</span>
|
||||
</button>
|
||||
<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 %}
|
||||
<hr class="dropdown-divider">
|
||||
{% for config in table_configs %}
|
||||
|
Loading…
Reference in New Issue
Block a user