Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot import name 'available_attrs' from 'django.utils.decorators' (django 3) #54

Closed
branis97 opened this issue Jan 18, 2020 · 5 comments

Comments

@branis97
Copy link

branis97 commented Jan 18, 2020

I installed django-ajax and when i try to migrate it i get this error :
cannot import 'available_attrs' from 'django.utils.decorators'

I have python 3.7.3 , Django 3.0.2

@branis97 branis97 changed the title Cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding' (django 3) Cannot import name 'available_attrs' from 'django.utils.decorators' (django 3) Jan 18, 2020
@yceruto
Copy link
Owner

yceruto commented Jan 19, 2020

Can you show the full stacktrace of the error? Are you sure this error is related to this library?

@branis97
Copy link
Author

branis97 commented Jan 21, 2020

Hello, this si full stacktrace of error:

Traceback (most recent call last):
  File "/Users/branislav/Desktop/learningcurvee/manage.py", line 21, in <module>
    main()
  File "/Users/branislav/Desktop/learningcurvee/manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "/Users/branislav/Desktop/learningcurvee/env/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/Users/branislav/Desktop/learningcurvee/env/lib/python3.7/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/branislav/Desktop/learningcurvee/env/lib/python3.7/site-packages/django/core/management/base.py", line 328, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/branislav/Desktop/learningcurvee/env/lib/python3.7/site-packages/django/core/management/base.py", line 366, in execute
    self.check()
  File "/Users/branislav/Desktop/learningcurvee/env/lib/python3.7/site-packages/django/core/management/base.py", line 395, in check
    include_deployment_checks=include_deployment_checks,
  File "/Users/branislav/Desktop/learningcurvee/env/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 64, in _run_checks
    issues.extend(super()._run_checks(**kwargs))
  File "/Users/branislav/Desktop/learningcurvee/env/lib/python3.7/site-packages/django/core/management/base.py", line 382, in _run_checks
    return checks.run_checks(**kwargs)
  File "/Users/branislav/Desktop/learningcurvee/env/lib/python3.7/site-packages/django/core/checks/registry.py", line 72, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/Users/branislav/Desktop/learningcurvee/env/lib/python3.7/site-packages/django/core/checks/urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "/Users/branislav/Desktop/learningcurvee/env/lib/python3.7/site-packages/django/core/checks/urls.py", line 23, in check_resolver
    return check_method()
  File "/Users/branislav/Desktop/learningcurvee/env/lib/python3.7/site-packages/django/urls/resolvers.py", line 407, in check
    for pattern in self.url_patterns:
  File "/Users/branislav/Desktop/learningcurvee/env/lib/python3.7/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/Users/branislav/Desktop/learningcurvee/env/lib/python3.7/site-packages/django/urls/resolvers.py", line 588, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/Users/branislav/Desktop/learningcurvee/env/lib/python3.7/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/Users/branislav/Desktop/learningcurvee/env/lib/python3.7/site-packages/django/urls/resolvers.py", line 581, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.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/branislav/Desktop/learningcurvee/learningcurvee/urls.py", line 14, in <module>
    path('', include('courses.urls')),
  File "/Users/branislav/Desktop/learningcurvee/env/lib/python3.7/site-packages/django/urls/conf.py", line 34, in include
    urlconf_module = import_module(urlconf_module)
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.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/branislav/Desktop/learningcurvee/courses/urls.py", line 3, in <module>
    from .views import CourseDetailView, CourseUpdateView, CreateSectionView, CreateLessonView, SectionUpdateView, \
  File "/Users/branislav/Desktop/learningcurvee/courses/views.py", line 12, in <module>
    from django_ajax.decorators import ajax
  File "/Users/branislav/Desktop/learningcurvee/env/lib/python3.7/site-packages/django_ajax/decorators.py", line 9, in <module>
    from django.utils.decorators import available_attrs
ImportError: cannot import name 'available_attrs' from 'django.utils.decorators' (/Users/branislav/Desktop/learningcurvee/env/lib/python3.7/site-packages/django/utils/decorators.py)

I can see that this library is using available_attrs from django.utils.decorator. New django removed some API support and I'm afraid that this is one of them.

@yceruto
Copy link
Owner

yceruto commented Jan 21, 2020

I see, so it's a compatibility issue with django 3. I will take a look this weekend, thanks for the information

@branis97
Copy link
Author

Yes, that is it. Sorry for incomplete information and thank you for your quick response.

@yceruto
Copy link
Owner

yceruto commented Jan 25, 2020

I've just released 3.2.0 with django3 support. Thanks for reporting.

@yceruto yceruto closed this as completed Jan 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants