juliarizza / djangocms_contact_form

Django-CMS contact form plugin with email integration
MIT License
2 stars 3 forks source link

Doesn't work for DjangoCMS >3.0.7 #1

Open xaoo opened 4 years ago

xaoo commented 4 years ago

The err. received:

Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "F:\Python38\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "F:\Python38\lib\site-packages\django\core\management\__init__.py", line 377, in execute
    django.setup()
  File "F:\Python38\lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "F:\Python38\lib\site-packages\django\apps\registry.py", line 114, in populate
    app_config.import_models()
  File "F:\Python38\lib\site-packages\django\apps\config.py", line 211, in import_models
    self.models_module = import_module(models_module_name)
  File "F:\Python38\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "F:\git\frontpage\venv\lib\site-packages\cmsplugin_contact_form\models.py", line 2, in <module>
    from django.utils.encoding import python_2_unicode_compatible
ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding' (F:\Python38\lib\site-packages\django\utils\encoding.py)

Possible fix? from six import python_2_unicode_compatible

pakal commented 3 years ago

Here is a quick fix I used until compatibility is updated

    import six
    import django.utils.encoding
    django.utils.encoding.python_2_unicode_compatible = six.python_2_unicode_compatible
Moon-developer commented 3 years ago

Here is a quick fix I used until compatibility is updated

    import six
    import django.utils.encoding
    django.utils.encoding.python_2_unicode_compatible = six.python_2_unicode_compatible

definitely a hacky method but it does the job until an update is made to the library

pakal commented 3 years ago

Btw I've updated https://pypi.org/project/django-compat-patcher/ with lots of new Django 3.0 and 3.1 fixes, it should solve this problem too.

raju10101997 commented 2 years ago

where are manage.py and settings.py file ?

pakal commented 2 years ago

@raju10101997 it's an installable plugin, install it with pip and then add it to your own project, in INSTALLED_APPS setting