Return child_model instead of model for use in bulk_edit_button

This commit is contained in:
Brian Tiemann 2024-09-24 11:29:43 -04:00
parent 485d3aee37
commit c5966be13b

View File

@ -129,7 +129,6 @@ 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:
@ -147,12 +146,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, 'model': self.child_model,
}) })
return render(request, self.get_template_name(), { return render(request, self.get_template_name(), {
'object': instance, 'object': instance,
'model': model, 'model': self.child_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,