Code

Opened 6 years ago

Closed 5 years ago

#7133 closed (duplicate)

django admin: radio_admin is broken with addPopup and RelatedObjectLookups.js

Reported by: trbs Owned by: nobody
Component: contrib.admin Version: newforms-admin
Severity: Keywords: radio_admin, relatedobjectlookups nfa_someday
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

It seems that radio_admin is broken in trunk's admin for adding new items through popup's.

django.contrib.redirects is an easy test case, create a project, put django.contrib.redirects in it and get the error when trying to add a new (with the plus symbol) record to the database and radio selection field.

Error message: (firebug)

SelectBox is not defined
http://localhost:8000/media/js/admin/RelatedObjectLookups.js
Line 73

After a little inspection of RelatedObjectLookups it seems to me that the entire javascript is not capable of handling radio_fields when adding new objects through the popup. The reason this error get's raised is because the javascript code handles it like it would be a combobox using the SelectBox javascript object instead of as a radio field. (The entire radio-field handling code is 'missing')

Since radio fields are no more in newforms-admin, it IMHO makes the most sense to remove the radio_admin option from the model in django.contrib.redirects (path attached)

Maybe also marking this option as deprecated in the documentation (http://www.djangoproject.com/documentation/model-api/) might be useful as it would disappear in nfa and seems to be currently broken (for a long time now? as i cannot find any revision that did handle adding items to the radio selection on page) for adding new items by popup in the admin pages.

Attachments (1)

7133-remove-radio_admin-from-redirects-contrib.diff (702 bytes) - added by trbs 6 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 6 years ago by trbs

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

see http://code.djangoproject.com/ticket/5731 for newforms-admin branch

comment:2 Changed 6 years ago by Karen Tracey <kmtracey@…>

  • Keywords nfa_someday added
  • Triage Stage changed from Unreviewed to Design decision needed
  • Version changed from SVN to newforms-admin

Radio fields were no more in newform-admin just because they hadn't been implemented, not because they were intended to be removed. They are implemented now and this problem now exists in newforms-admin. While you can use the popup to add an item, the newly-added item doesn't show up in the radio list until you manually refresh the page. I have no idea how to fix this -- javascript is not something I've done much work with. Someone with more knowledge than I in this area needs to decide what to do about it, but at any rate since it was a problem in old admin it shouldn't block merge so marking nfa_someday.

comment:3 Changed 5 years ago by trbs

As far as i can see this is not applicable anymore on post-Django 1.0
Recommend closing the ticket. (also added a patch to a new ticket, fixing/adding the dynamic additions of items to a radiolist in the admin: #10191 )

comment:4 Changed 5 years ago by kmtracey

  • Resolution set to duplicate
  • Status changed from new to closed

I don't see why a new ticket was needed here -- the identified problem could as easily have been fixed under this ticket as a new one. You could have changed the summary, version, etc. to more accurately describe the current situation, if necessary. But, since you've created a new ticket and put the patch there, we can use that one. (You also could have closed this yourself -- no special privs are needed to close tickets.)

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.