mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #24951 -- Fixed AssertionError in delete queries involving a foreign/primary key.
Thanks Anssi Kääriäinen for help.
This commit is contained in:
@@ -995,7 +995,7 @@ class SQLDeleteCompiler(SQLCompiler):
|
||||
Creates the SQL for this query. Returns the SQL string and list of
|
||||
parameters.
|
||||
"""
|
||||
assert len(self.query.tables) == 1, \
|
||||
assert len([t for t in self.query.tables if self.query.alias_refcount[t] > 0]) == 1, \
|
||||
"Can only delete from one table at a time."
|
||||
qn = self.quote_name_unless_alias
|
||||
result = ['DELETE FROM %s' % qn(self.query.tables[0])]
|
||||
|
||||
Reference in New Issue
Block a user