#25903 closed Bug (fixed)
"Add another" related field buttons in list_editable don't open a popup
Reported by: | Federico Curzel | Owned by: | Tim Graham |
---|---|---|---|
Component: | contrib.admin | Version: | 1.9 |
Severity: | Release blocker | Keywords: | modeladmin popup |
Cc: | rm_ | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I am referring to the popups you can use to creare a new record on-the-fly while editing an other record.
After upgrade from Django 1.7 to 1.9 those popups aren't opening a popup in the web browser anymore, instead, the page will change, allowing to create a new record.
After saving, a page saying "Closing Popup" will appear, but the page won't go back to the original one.
Attachments (1)
Change History (18)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Summary: | ModelAdmin popups wont'close → ModelAdmin popups won't close |
---|---|
Type: | Uncategorized → Bug |
comment:3 by , 9 years ago
Sorry for not doing this before.
In the "Popup Closing..." page there is a JS error.
Chrome :
Uncaught TypeError: Cannot read property 'dismissAddRelatedObjectPopup' of null
Firefox :
TypeError: opener is null
comment:5 by , 9 years ago
Third Party applications are django object actions, django rest framework and django wpadmin.
http://www.django-rest-framework.org/
https://github.com/barszczmm/django-wpadmin
https://github.com/crccheck/django-object-actions
But the likely culprit is django wpadmin, which I forked long ago, and used with Django 1.7.
After upgrading to Django 1.9, Django WpAdmin had some issues, but I thought I fixed everything.
If the error is not replicable by anyone, this might be the cause.
comment:6 by , 9 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Okay, it works for me -- so I'll close this for now. If you can reproduce without those other apps, please reopen.
comment:7 by , 9 years ago
Resolution: | worksforme |
---|---|
Status: | closed → new |
Same here without those apps. Function showAdminPopup
is called from change_form.html
template but not from change_list.html
. So from change_form popup is opened correctly, but in change_list it's just a link without js events.
follow-up: 9 comment:8 by , 9 years ago
Could you please be more specific with a sample project and/or steps to reproduce?
by , 9 years ago
Attachment: | djadmintest.zip added |
---|
comment:9 by , 9 years ago
Replying to timgraham:
Could you please be more specific with a sample project and/or steps to reproduce?
Sorry, forgot to mention that i'm using custom ModelAdmin with list_editable field.
In attachment you can find sample project to reproduce the bug:
- Create new Product. In the product creation form click on "Add another category" will popup new window as expected.
- Navigate to /admin/products/product/. Click on "Add another category" near the product category will not open popup.
Sample project created using python2.
comment:10 by , 9 years ago
Severity: | Normal → Release blocker |
---|---|
Summary: | ModelAdmin popups won't close → "Add another" related field buttons in list_editable don't open a popup |
Triage Stage: | Unreviewed → Accepted |
Thanks, bisected to 0decef337f7f00d73b380531ac22cbc843d6e806 (#24405).
comment:11 by , 9 years ago
Cc: | added |
---|
Hi Riccardo, do you have time to help with this regression from your patch? I guess we're missing test coverage for this case.
comment:12 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:13 by , 9 years ago
Ah missed the previous email sorry. Don't have time atm to cook a patch but from a quick look it looks like that indeed moving django/contrib/admin/static/admin/js/related-widget-wrapper.js content from a separatated file to change_form.html broke popup handling outside of that template. So the change list template needs lines 90-108 from change_form.html and django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js included to work. We can move that 18 lines to a separate js if we don't want to duplicate them i suppose.
comment:14 by , 9 years ago
Has patch: | set |
---|
PR for the stable/1.9.x branch (will do a separate one for master since it's not a clean forwardport).
comment:15 by , 9 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
Submited patch against 1.9 looks good to me.
I didn't even know this button showed up in an editable changelist and could have broken it myself when I refactored this part of the admin to add edit/delete buttons.
Possibly you have some cached JavaScript in your browser? Could you try clearing your cache and also check the JavaScript console of your browser for any errors?