Question

I have a django app, and on the backend I've got a many to many field that I've set in the 'raw_id_fields' property in the ModelAdmin class. When running it locally, everything is fine, but when I test on the live site, the link to the lookup popout window doesnt work.

The django app resides at example.com/djangoapp/ and the admin is example.com/djangoapp/admin/

The links that the admin is generating for the lookup is example.com/admin/lookup_url/ rather tahn example.com/djangoapp/admin/lookup_url/

Any ideas why this is happening? Other links within the admin work fine, it just seems to be these raw id lookups.

Thanks for the help.

Edit: In the source for the page when rendered, the breadcrumbs have the following:

<div class="breadcrumbs">
 <a href="../../../">Home</a> &rsaquo;

This link works fine, going back to the root of the admin (example.com/djangoapp/admin/)

The HTML for the broken lookup link is:

<a href="../../../auth/user/?t=id" class="related-lookup" id="lookup_id_user" onclick="return showRelatedObjectLookupPopup(this);"> 

Looks like it might have something to do with the JS instead of the link itself.

Was it helpful?

Solution

This sounds like a bug in Django, I've seen a few of this kind. I'm pretty sure it has to do with the fact that you placed your admin at example.com/djangoapp/admin/ instead of example.com/admin/ which is the default. I have a hunch that if you change the admin url, it will work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top