django-smart-selects icon indicating copy to clipboard operation
django-smart-selects copied to clipboard

It doesn't work when I change the admin path

Open admmello opened this issue 3 years ago • 3 comments
trafficstars

when I change the admin URL from

urlpatterns = [
    path('admin/', admin.site.urls),
    path('chaining/', include('smart_selects.urls')),
....

to

urlpatterns = [
    path('', admin.site.urls),
    path('chaining/', include('smart_selects.urls')),
....

django-smart-selects stops working. How can I fix this?

admmello avatar Nov 30 '21 23:11 admmello

Hi @admmello : I know this question is now old, but since it was unanswered--there goes nothing :

It is strange, and I can not fathom with my limited knowledge of either of the projects at this point (i.e. your proj, and this git).

However, if it indeed is, as you seem to indicate it to be, I would take a wild guess and say that keeping both paths should resolve it ; kindly try:

urlpatterns = [ path('admin/', admin.site.urls), path('', admin.site.urls), path('chaining/', include('smart_selects.urls')), ....

pareshpandit avatar Jun 10 '22 17:06 pareshpandit

I found another way to solve this, I created a view of path ('', home, name = 'home'), and inside the home.html I put an empty HTML with a meta to redirect automatically

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Refresh" content="0; url={% url 'admin:login' %}" />
    <title>Title</title>
</head>
<body>
</body>
</html>

admmello avatar Jun 10 '22 18:06 admmello

Hey @admmello, I had the same problem and was able to solve it by just changing the order in my urlpattern.

urlpatterns = [  
    re_path(r'^chaining/', include('smart_selects.urls')),  
    path('', admin.site.urls),
]

jonimke avatar Nov 16 '22 17:11 jonimke