Skip to content

Commit f9caf7e

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 b611a24 commit f9caf7e

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
@@ -690,7 +690,7 @@ def add_field(self, model, field):
690690
self.connection.close()
691691

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

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

0 commit comments

Comments
 (0)