Skip to content

Commit

Permalink
Fix broken bulk changes in inline views
Browse files Browse the repository at this point in the history
The bulk change would previously try to use a form of the parent model.
  • Loading branch information
sp-tm committed Nov 13, 2024
1 parent 35d92e3 commit 8dcccc6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions is_core/generic_views/table_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from is_core.rest.filters import UIFilterMixin, FilterChoiceIterator
from is_core.rest.datastructures import ModelFlatRestFields, ModelRestFieldset
from is_core.utils import (
pretty_class_name, get_export_types_with_content_type, LOOKUP_SEP, get_field_label_from_path
pretty_class_name, get_export_types_with_content_type, LOOKUP_SEP, get_field_label_from_path, get_model_name
)

from chamber.utils.http import query_string_from_dict
Expand Down Expand Up @@ -363,12 +363,17 @@ def get_context_data(self, **kwargs):
return context_data

def get_bulk_change_snippet_name(self):
return '-'.join(('default', self.core.menu_group, 'form'))
model = getattr(self, "model", None)
snippet_model_name = get_model_name(model) if model and hasattr(model, '_meta') else self.core.menu_group
return "-".join(("default", snippet_model_name, "form"))

def get_bulk_change_form_url(self):
model = getattr(self, "model", None)
snippet_model_name = get_model_name(model) if model and hasattr(model, '_meta') else self.core.menu_group
return (
reverse(''.join(('IS:', self.core.get_bulk_change_url_name(), '-', self.core.menu_group)))
if self.is_bulk_change_enabled() else None
reverse("".join(("IS:", self.core.get_bulk_change_url_name(), "-", snippet_model_name)))
if self.is_bulk_change_enabled()
else None
)

def _get_menu_group_pattern_name(self):
Expand Down

0 comments on commit 8dcccc6

Please sign in to comment.