开发者

Django raw id field lookup has the wrong link

开发者 https://www.devze.com 2022-12-08 22:15 出处:网络
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

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.c开发者_如何学编程om/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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消