-
Notifications
You must be signed in to change notification settings - Fork 704
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
Missing spyglass icon in raw_id_fields widget when updating to django 1.8 #360
Comments
The problem seems to be that in Django 1.8 the raw-id-field widget mechanism was changed from an HTML element to a css rule + event hooks for the "related-lookup" class. The following patch does the trick, though probably not the best solution to fit the package architecture. Add the missing js code to change_form.html
And the following css rules: .add-another, .related-lookup { .related-lookup { |
This fix is not sufficient. When clicking the magnifying glass icon, the browser is redirected to the relevant admin list view, which is wrong. |
I am experiencing the same issue with
We managed to make it work like this: {% block extrahead %}
<script type="text/javascript"><!--
$( function() {
$( '.related-lookup:not([onclick])' ).click( function() {
return showRelatedObjectLookupPopup( this ) ;
}) ;
} ) ;
//--></script>
{% endblock %} |
@marcwebbie thanks! I'm not actually using Django-Suit (using Django Admin Bootstrapped), but that same solution as you indicate worked for me as well. |
Hi @marcwebbie , could you please let me know which file you placed the block extrahead code into? p.s. @darklow I've tried 0.2.13, 0.2.14 and 0.2.15 but all do not work for the raw id field popup |
Hello @calebjoseph and @darklow, I've added this snippet on
|
Thanks @marcwebbie , works like a charm. |
Also, don't forget to upgrade your admin jquery. |
I'm not sure what causes this, but it is easily reproducible with a freshly installed django (1.8) app without any 3rd parties.
In the admin.py we have something like this (Author is foreign key of Book):
class BookAdmin(admin.ModelAdmin):
raw_id_fields = ('author', )
class AuthorAdmin(admin.ModelAdmin):
list_display = ['name',]
admin.site.register(Book, BookAdmin)
admin.site.register(Author, AuthorAdmin)
Adding suit (0.2.12) to installed apps will cause the spyglass icon to disappear. Remove it, and all is well.
The text was updated successfully, but these errors were encountered: