Skip to content

Commit

Permalink
Backwards compatibility for deferrable kwarg
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
davidjb committed Mar 3, 2021
1 parent 7591b31 commit 9ee0830
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mssql/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ def add_field(self, model, field):
self.connection.close()

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

def create_unique_name(*args, **kwargs):
Expand Down

0 comments on commit 9ee0830

Please sign in to comment.