Skip to content

Commit

Permalink
adapt SQLDeleteCompiler.execute_sql()
Browse files Browse the repository at this point in the history
  • Loading branch information
timgraham committed Jan 9, 2025
1 parent e876eec commit 9c4f7ac
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions django_mongodb_backend/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from django.utils.functional import cached_property
from pymongo import ASCENDING, DESCENDING

from .base import Cursor
from .query import MongoQuery, wrap_database_errors


Expand Down Expand Up @@ -705,15 +704,12 @@ def collection_name(self):

class SQLDeleteCompiler(compiler.SQLDeleteCompiler, SQLCompiler):
def execute_sql(self, result_type=MULTI):
cursor = Cursor()
try:
query = self.build_query()
except EmptyResultSet:
rowcount = 0
return 0
else:
rowcount = query.delete()
cursor.rowcount = rowcount
return cursor
return query.delete()

def check_query(self):
super().check_query()
Expand Down

0 comments on commit 9c4f7ac

Please sign in to comment.