From 3e82ddb5cb9546c50988b110b2d0855237609457 Mon Sep 17 00:00:00 2001 From: Andre Anjos <andre.dos.anjos@gmail.com> Date: Thu, 28 Apr 2016 11:01:09 +0200 Subject: [PATCH] [settings] Suppress django 1.10 deprecation warning caused by django jsonfield provisionally --- beat/web/settings/settings.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/beat/web/settings/settings.py b/beat/web/settings/settings.py index 0e1f6af8d..337b9fedd 100644 --- a/beat/web/settings/settings.py +++ b/beat/web/settings/settings.py @@ -126,6 +126,27 @@ LOGGING = { } } +############################################################################## +# +# Special code to remove Django 1.10 deprecation warnings caused by +# Django-JSONField while that is not resolved: +# https://bitbucket.org/schinckel/django-jsonfield/issues/46/django-190-complains-about-subfieldbase +# Current django-jsonfield available: 0.9.19 (28.04.2016) +# +############################################################################## +import logging + +class SuppressDeprecated(logging.Filter): + def filter(self, record): + WARNINGS_TO_SUPPRESS = [ + 'RemovedInDjango110Warning', + ] + # Return false to suppress message. + return not any([warn in record.getMessage() for warn in WARNINGS_TO_SUPPRESS]) + +warn_logger = logging.getLogger('py.warnings') +warn_logger.addFilter(SuppressDeprecated()) + ############################################################################## # # DATABASE -- GitLab