Skip to content

Commit 3de1492

Browse files
committed
Use collections.abc.Iterable instead of collections.Iterable
The latter is going to be removed after Python 3.8
1 parent 946e9a6 commit 3de1492

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

localized_fields/value.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import deprecation
2-
import collections
32

43
from typing import Optional
4+
from collections.abc import Iterable
5+
56
from django.conf import settings
67
from django.utils import translation
78

@@ -97,7 +98,7 @@ def _interpret_value(self, value):
9798
lang_value = value.get(lang_code, self.default_value)
9899
self.set(lang_code, lang_value)
99100

100-
elif isinstance(value, collections.Iterable):
101+
elif isinstance(value, Iterable):
101102
for val in value:
102103
self._interpret_value(val)
103104

requirements/base.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
django-postgres-extra==1.21a9
1+
django-postgres-extra==1.22
22
deprecation==2.0.3

settings.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,33 @@
2424
'django.contrib.auth',
2525
'django.contrib.contenttypes',
2626
'django.contrib.admin',
27+
'django.contrib.messages',
2728
'localized_fields',
2829
'tests',
2930
)
3031

32+
TEMPLATES = [
33+
{
34+
"BACKEND": "django.template.backends.django.DjangoTemplates",
35+
"DIRS": [],
36+
"APP_DIRS": True,
37+
"OPTIONS": {
38+
"context_processors": [
39+
"django.template.context_processors.debug",
40+
"django.template.context_processors.request",
41+
"django.contrib.auth.context_processors.auth",
42+
"django.contrib.messages.context_processors.messages",
43+
],
44+
},
45+
},
46+
]
47+
48+
MIDDLEWARE = [
49+
'django.contrib.messages.middleware.MessageMiddleware',
50+
'django.contrib.sessions.middleware.SessionMiddleware',
51+
'django.contrib.auth.middleware.AuthenticationMiddleware',
52+
]
53+
3154
# set to a lower number than the default, since
3255
# we want the tests to be fast, default is 100
3356
LOCALIZED_FIELDS_MAX_RETRIES = 3

0 commit comments

Comments
 (0)