A
A
Alexander2018-02-06 22:44:31
Django
Alexander, 2018-02-06 22:44:31

How to force Django admin to delete via QuerySet.delete?

There is a model, it has a manager:

class QuerySet(models.QuerySet):
    def delete(self):
        self.update(is_delete=True)


class BaseManager(models.Manager):
    def get_queryset(self):
        return QuerySet(self.model).filter(is_delete=False)

I delete via "delete selected objects" , okay, using QuerySet.delete() .
I delete via POST 127.0.0.1:8000/admin/article/7/delete as I understand it, Model.delete() is used .

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question