Avoid a Python deprecation warning with the collections patch.
Review Request #12312 — Created May 31, 2022 and submitted — Latest diff uploaded
Django Evolution provides a compatibility patch to enable
collections.Callable
on Python 3.10 with Django <= 2.0. To check
whether to apply the patch, we were checking for the existence of
collections.Callable
and the Django version.The first check led to a deprecation warning on modern versions of
Python, which is annoying when running on a version of Django not
susceptible to the old imports. Instead, we now check the Django version
first, avoiding the warning.
Started up a dev server and saw that the warning no longer appeared.