mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-06 07:38:16 -06:00
Set model in context
This commit is contained in:
parent
8940732a86
commit
485d3aee37
@ -129,6 +129,7 @@ class ObjectChildrenView(ObjectView, ActionsMixin, TableMixin):
|
|||||||
GET handler for rendering child objects.
|
GET handler for rendering child objects.
|
||||||
"""
|
"""
|
||||||
instance = self.get_object(**kwargs)
|
instance = self.get_object(**kwargs)
|
||||||
|
model = self.queryset.model
|
||||||
child_objects = self.get_children(request, instance)
|
child_objects = self.get_children(request, instance)
|
||||||
|
|
||||||
if self.filterset:
|
if self.filterset:
|
||||||
@ -146,10 +147,12 @@ class ObjectChildrenView(ObjectView, ActionsMixin, TableMixin):
|
|||||||
return render(request, 'htmx/table.html', {
|
return render(request, 'htmx/table.html', {
|
||||||
'object': instance,
|
'object': instance,
|
||||||
'table': table,
|
'table': table,
|
||||||
|
'model': model,
|
||||||
})
|
})
|
||||||
|
|
||||||
return render(request, self.get_template_name(), {
|
return render(request, self.get_template_name(), {
|
||||||
'object': instance,
|
'object': instance,
|
||||||
|
'model': model,
|
||||||
'child_model': self.child_model,
|
'child_model': self.child_model,
|
||||||
'base_template': f'{instance._meta.app_label}/{instance._meta.model_name}.html',
|
'base_template': f'{instance._meta.app_label}/{instance._meta.model_name}.html',
|
||||||
'table': table,
|
'table': table,
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
<div hx-swap-oob="innerHTML:.total-object-count">{{ table.rows|length }}</div>
|
<div hx-swap-oob="innerHTML:.total-object-count">{{ table.rows|length }}</div>
|
||||||
|
|
||||||
{# Update the bulk action buttons with new query parameters #}
|
{# Update the bulk action buttons with new query parameters #}
|
||||||
{% if actions and model %}
|
{% if actions %}
|
||||||
<div class="bulk-action-buttons" hx-swap-oob="outerHTML:.bulk-action-buttons">
|
<div class="bulk-action-buttons" hx-swap-oob="outerHTML:.bulk-action-buttons">
|
||||||
{% if 'bulk_edit' in actions %}
|
{% if 'bulk_edit' in actions %}
|
||||||
{% bulk_edit_button model query_params=request.GET %}
|
{% bulk_edit_button model query_params=request.GET %}
|
||||||
|
Loading…
Reference in New Issue
Block a user