mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-05 15:18:18 -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.
|
||||
"""
|
||||
instance = self.get_object(**kwargs)
|
||||
model = self.queryset.model
|
||||
child_objects = self.get_children(request, instance)
|
||||
|
||||
if self.filterset:
|
||||
@ -146,10 +147,12 @@ class ObjectChildrenView(ObjectView, ActionsMixin, TableMixin):
|
||||
return render(request, 'htmx/table.html', {
|
||||
'object': instance,
|
||||
'table': table,
|
||||
'model': model,
|
||||
})
|
||||
|
||||
return render(request, self.get_template_name(), {
|
||||
'object': instance,
|
||||
'model': model,
|
||||
'child_model': self.child_model,
|
||||
'base_template': f'{instance._meta.app_label}/{instance._meta.model_name}.html',
|
||||
'table': table,
|
||||
|
@ -20,7 +20,7 @@
|
||||
<div hx-swap-oob="innerHTML:.total-object-count">{{ table.rows|length }}</div>
|
||||
|
||||
{# 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">
|
||||
{% if 'bulk_edit' in actions %}
|
||||
{% bulk_edit_button model query_params=request.GET %}
|
||||
|
Loading…
Reference in New Issue
Block a user