Skip to content

Commit 9ee0830

Browse files
committed
Backwards compatibility for deferrable kwarg
This was previously accepted to the original repository in ESSolutions/django-mssql-backend#86. Backwards compatibility for Django < 3.1 is maintained by not directly trying to load the supports_deferrable_unique_constraints via dot notation, but rather by getattr with a default.
1 parent 7591b31 commit 9ee0830

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mssql/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ def add_field(self, model, field):
689689
self.connection.close()
690690

691691
def _create_unique_sql(self, model, columns, name=None, condition=None, deferrable=None):
692-
if (deferrable and not self.connection.features.supports_deferrable_unique_constraints):
692+
if (deferrable and not getattr(self.connection.features, 'supports_deferrable_unique_constraints', False)):
693693
return None
694694

695695
def create_unique_name(*args, **kwargs):

0 commit comments

Comments
 (0)