Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken bulk changes in inline views #12

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 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,23 @@ def get_context_data(self, **kwargs):
return context_data

def get_bulk_change_snippet_name(self):
return '-'.join(('default', self.core.menu_group, 'form'))
try:
snippet_model_name = get_model_name(self.model)
except Exception:
snippet_model_name = self.core.menu_group

return "-".join(("default", snippet_model_name, "form"))

def get_bulk_change_form_url(self):
try:
snippet_model_name = get_model_name(self.model)
except Exception:
snippet_model_name = 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
Loading