justinmayer / django-autoslug

AutoSlugField for Django. Supports (but not does not require) unidecode/pytils for transliteration. Old issue tracker is at Bitbucket: https://bitbucket.org/neithere/django-autoslug/issues

Home Page:https://readthedocs.org/projects/django-autoslug/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doesn't work with Django 3.1

maxmalysh opened this issue · comments

Hi,

I tried django-autoslug==1.9.7 with django==3.1rc1 and got this error:

Traceback (most recent call last):
  File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/mmalysh/Dev/my-project/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/Users/mmalysh/Dev/my-project/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 377, in execute
    django.setup()
  File "/Users/mmalysh/Dev/my-project/venv/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/mmalysh/Dev/my-project/venv/lib/python3.7/site-packages/django/apps/registry.py", line 114, in populate
    app_config.import_models()
  File "/Users/mmalysh/Dev/my-project/venv/lib/python3.7/site-packages/django/apps/config.py", line 211, in import_models
    self.models_module = import_module(models_module_name)
  File "/Users/mmalysh/.pyenv/versions/3.7.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/mmalysh/Dev/my-project/src/apps/stats/models.py", line 6, in <module>
    from autoslug import AutoSlugField
  File "/Users/mmalysh/Dev/my-project/venv/lib/python3.7/site-packages/autoslug/__init__.py", line 12, in <module>
    from autoslug.fields import AutoSlugField
  File "/Users/mmalysh/Dev/my-project/venv/lib/python3.7/site-packages/autoslug/fields.py", line 30, in <module>
    from autoslug.settings import slugify, autoslug_modeltranslation_enable
  File "/Users/mmalysh/Dev/my-project/venv/lib/python3.7/site-packages/autoslug/settings.py", line 71, in <module>
    slugify = get_callable(slugify_function_path)
  File "/Users/mmalysh/Dev/my-project/venv/lib/python3.7/site-packages/django/urls/utils.py", line 28, in get_callable
    mod = import_module(mod_name)
  File "/Users/mmalysh/.pyenv/versions/3.7.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/Users/mmalysh/Dev/my-project/venv/lib/python3.7/site-packages/autoslug/utils.py", line 17, in <module>
    from django.db.models.fields import FieldDoesNotExist, DateField
ImportError: cannot import name 'FieldDoesNotExist' from 'django.db.models.fields' (/Users/mmalysh/Dev/my-project/venv/lib/python3.7/site-packages/django/db/models/fields/__init__.py)

Here is a release note related to the error:

The compatibility import of django.core.exceptions.FieldDoesNotExist in django.db.models.fields is removed.

Django release notes: https://docs.djangoproject.com/en/3.1/releases/3.1/

PR#67 fixes this error:

#67

Fix merged via 10da04e and released in django-autoslug 1.9.8. Many thanks for the contribution, @kangfend! 💫