Skip to content

Commit

Permalink
Make tests pass against Django 3.0b1
Browse files Browse the repository at this point in the history
  • Loading branch information
Photonios committed Nov 3, 2019
1 parent 2ff3a5d commit 5a906d1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion psqlextra/indexes/case_insensitive_unique_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class CaseInsensitiveUniqueIndex(Index):
"CREATE UNIQUE INDEX %(name)s ON %(table)s (%(columns)s)%(extra)s"
)

def create_sql(self, model, schema_editor, using=""):
def create_sql(self, model, schema_editor, using="", **kwargs):
statement = super().create_sql(model, schema_editor, using)
statement.template = self.sql_create_unique_index

Expand Down
2 changes: 1 addition & 1 deletion psqlextra/indexes/conditional_unique_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self, condition: str, fields=[], name=None):

self._condition = condition

def create_sql(self, model, schema_editor, using=""):
def create_sql(self, model, schema_editor, using="", **kwargs):
"""Creates the actual SQL used when applying the migration."""
if django.VERSION >= (2, 0):
statement = super().create_sql(model, schema_editor, using)
Expand Down
9 changes: 2 additions & 7 deletions psqlextra/sql.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from collections import OrderedDict
from typing import List, Optional, Tuple

from django.core.exceptions import SuspiciousOperation
Expand Down Expand Up @@ -51,12 +50,8 @@ def rename_annotations(self, annotations) -> None:
).format(old_name=old_name, new_name=new_name)
)

self._annotations = OrderedDict(
[
(new_name, v) if k == old_name else (k, v)
for k, v in self._annotations.items()
]
)
self.annotations[new_name] = annotation
del self.annotations[old_name]

def add_fields(
self, field_names: List[str], allow_m2m: bool = True
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[tox]
envlist = py37-dj{20,21,22}, py38-dj{20,21,22}
envlist = py37-dj{20,21,22,30}, py38-dj{20,21,22,30}

[testenv]
deps =
dj20: Django>=2.0,<2.1
dj21: Django>=2.1,<2.2
dj22: Django>=2.2,<2.3
dj30: Django>=3.0b1
.[test]
setenv =
DJANGO_SETTINGS_MODULE=settings
Expand Down

0 comments on commit 5a906d1

Please sign in to comment.