It seems that this behavior comes from ManyToManyField, which wants to use its own manager, which is referenced by related objects , because when I try to make some of my own instances and try to gently delete them using your model code (via the manage shell. py) everything works as intended.
, , . 15 ManyToManyField, , ( django/db/models/fields/related.py).
, , use_for_related_fields = True SoftDeleteManager, :
class SoftDeleteManager(models.Manager):
use_for_related_fields = True
def get_query_set(self):
query_set = super(SoftDeleteManager, self).get_query_set()
return query_set.filter(deleted_at__isnull = True)
: Trip 2 Destination s, TripDestination, Destination deleted_at datetime.datetime.now(), Destination , mytrip.destinations.all(), , , .
, , , get_query_set() , , , , .