Skip to content

Commit

Permalink
Fix action delete error (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
vb64 authored Jan 22, 2023
1 parent 5f471e0 commit 8e063ed
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion django_admin_geomap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ def geomap_latitude(self):
raise NotImplementedError("{}.geomap_latitude".format(self.__class__.__name__))


def is_special_case(response):
"""Check DjangoAdmin response for special cases."""
return (not hasattr(response, 'context_data')) or ('cl' not in response.context_data)


class ModelAdmin(admin.ModelAdmin):
"""Base class for admin model with geomap support."""

Expand Down Expand Up @@ -98,7 +103,7 @@ def changelist_view(self, request, extra_context=None):
# Obtain original response from Django
response = super().changelist_view(request, extra_context=extra_context)

if not self.geomap_show_map_on_list:
if (not self.geomap_show_map_on_list) or is_special_case(response):
return response

# Obtain final queryset from ChangeList object
Expand Down

0 comments on commit 8e063ed

Please sign in to comment.