Since the project use python_2_unicode_compatible decorator and django3 dropped support for python2 maybe it's time to remove it or if the aim is to make it still compatible with older project maybe the solution could be something like create a doing-nothing decorator if import fails:
try:
from django.utils.encoding import python_2_unicode_compatible
except ImportError:
def python_2_unicode_compatible(klass):
"""
Since python2 no more supported in django3
it would suffice to create a fake decorator if import fails
"""
return klass
Since the project use python_2_unicode_compatible decorator and django3 dropped support for python2 maybe it's time to remove it or if the aim is to make it still compatible with older project maybe the solution could be something like create a doing-nothing decorator if import fails: