From 3de1492a58fef6b233230b57999bfbd9e136d91d Mon Sep 17 00:00:00 2001 From: Swen Kooij Date: Wed, 14 Aug 2019 08:57:05 +0300 Subject: [PATCH] Use collections.abc.Iterable instead of collections.Iterable The latter is going to be removed after Python 3.8 --- localized_fields/value.py | 5 +++-- requirements/base.txt | 2 +- settings.py | 23 +++++++++++++++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/localized_fields/value.py b/localized_fields/value.py index 1c738d8..a1d7c29 100644 --- a/localized_fields/value.py +++ b/localized_fields/value.py @@ -1,7 +1,8 @@ import deprecation -import collections from typing import Optional +from collections.abc import Iterable + from django.conf import settings from django.utils import translation @@ -97,7 +98,7 @@ class LocalizedValue(dict): lang_value = value.get(lang_code, self.default_value) self.set(lang_code, lang_value) - elif isinstance(value, collections.Iterable): + elif isinstance(value, Iterable): for val in value: self._interpret_value(val) diff --git a/requirements/base.txt b/requirements/base.txt index a23e0fb..7914f51 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,2 +1,2 @@ -django-postgres-extra==1.21a9 +django-postgres-extra==1.22 deprecation==2.0.3 diff --git a/settings.py b/settings.py index 722d74e..063cefe 100644 --- a/settings.py +++ b/settings.py @@ -24,10 +24,33 @@ INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.admin', + 'django.contrib.messages', 'localized_fields', 'tests', ) +TEMPLATES = [ + { + "BACKEND": "django.template.backends.django.DjangoTemplates", + "DIRS": [], + "APP_DIRS": True, + "OPTIONS": { + "context_processors": [ + "django.template.context_processors.debug", + "django.template.context_processors.request", + "django.contrib.auth.context_processors.auth", + "django.contrib.messages.context_processors.messages", + ], + }, + }, +] + +MIDDLEWARE = [ + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', +] + # set to a lower number than the default, since # we want the tests to be fast, default is 100 LOCALIZED_FIELDS_MAX_RETRIES = 3