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

ImportError: cannot import name 'url' from 'django.conf.urls' on Django 4.0 #34

Open
FriedrichFroebel opened this issue Jan 23, 2022 · 1 comment

Comments

@FriedrichFroebel
Copy link

I discovered your project today while researching some stuff and tried to include it into my project. This failed as Django 4.0 removed the django.conf.urls.url method which had been deprecated in Django 3.0.

For this reason I am currently using a workaround in my urls.py file:

from django.urls import path, include
from searchableselect.views import filter_models as searchable_select_filter_models

urlpatterns = [
    # Original solution does not work for Django 4.0.
    # path("searchableselect/", include("searchableselect.urls")),
    path(
        "searchable-select/",
        searchable_select_filter_models,
        name="searchable-select-filter",
    ),
]

As far as I have seen, the other functionality seems to work with Django 4.0.

@MicheleTsigab
Copy link

It is because django.urls.url is deprecated since django 4.0,
Instead Go to 'path/to/searchableselect/urls.py' and
use from django.urls import re_path, also change url('^filter....) to re_path('^filter..)

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