#32659: Autocomplete field: The results could not be loaded.
-------------------------------+--------------------------------------
     Reporter:  honyczek       |                    Owner:  nobody
         Type:  Bug            |                   Status:  closed
    Component:  contrib.admin  |                  Version:  3.2
     Severity:  Normal         |               Resolution:  needsinfo
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------

Comment (by Erik van Widenfelt):

 ok, you are correct. This is not a bug.

 I had this issue because I was incorrectly declaring url paths in the
 `urls.py` for my project. The issue is not with `sites.py` nor
 `autocomplete.py`.

 The way I setup the admin URLs for all the admin sites in the project
 risked non-unique urls; namely, for `autocomplete`.

     # WRONG
     path("admin/", app_one_admin.urls),  # reverses to
 `admin/autocomplete` will always hit this AdminSite !!
     path("admin/", app_two_admin.urls), # reverses to `admin/autocomplete`
     path("admin/", app_three_admin.urls), # reverses to
 `admin/autocomplete`
     path("admin/", admin.site.urls), # reverses to `admin/autocomplete`

 The better way is:

     # better
     path("app_one_admin/", app_one_admin.urls),  # reverses to
 `app_one_admin/autocomplete`
     path("app_two_admin/", app_two_admin.urls), # reverses to
 `app_two_admin/autocomplete`
     path("app_three_admin/", app_three_admin.urls), # reverses to
 `app_three_admin/autocomplete`
     path("admin/", admin.site.urls), # reverses to `admin/autocomplete`

 See docs https://docs.djangoproject.com/en/3.2/ref/contrib/admin
 /#multiple-admin-sites-in-the-same-urlconf

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32659#comment:13>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.1331429091fbca087a6d6367686ab08e%40djangoproject.com.

Reply via email to