Skip to content

Commit

Permalink
Revert "fix: speed up get deleted. remove unnecessary subquery"
Browse files Browse the repository at this point in the history
  • Loading branch information
etianen authored Nov 8, 2023
1 parent 5a1eccf commit 24d4298
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion reversion/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,12 @@ def get_deleted(self, model, model_db=None):
# conditional expressions are being supported since django 3.0
# DISTINCT ON works only for Postgres DB
if connection.vendor == "postgresql" and django.VERSION >= (3, 0):
return (
subquery = (
self.get_for_model(model, model_db=model_db)
.filter(~models.Exists(model_qs))
.order_by("object_id", "-pk")
.distinct("object_id")
.values("pk")
)
else:
subquery = (
Expand Down

0 comments on commit 24d4298

Please sign in to comment.