Skip to content

Commit

Permalink
fix: deletion of entity objects
Browse files Browse the repository at this point in the history
In GenericEntitiesDeleteView, override get_queryset() method
instead of referencing a specific (parent) model to get at the
object-to-be-deleted.

Closes #485
  • Loading branch information
koeaw committed Dec 20, 2023
1 parent 59ed073 commit 87c50f1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apis_core/apis_entities/edit_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,13 @@ def post(self, request, *args, **kwargs):

@method_decorator(login_required, name="dispatch")
class GenericEntitiesDeleteView(EntityInstanceMixin, DeleteView):
# model = ContentType.objects.get(
# app_label='apis_entities', model='tempentityclass').model_class()
model = importlib.import_module("apis_core.apis_entities.models").TempEntityClass
template_name = getattr(
settings, "APIS_DELETE_VIEW_TEMPLATE", "confirm_delete.html"
)

def get_queryset(self):
return self.entity_model.objects.all()

def dispatch(self, request, *args, **kwargs):
self.success_url = reverse(
"apis_core:apis_entities:generic_entities_list",
Expand Down

0 comments on commit 87c50f1

Please sign in to comment.