Fix usability issue with limit_choices_to and "Add another" in admin
django34: We have the ability to put a customized limit/filter on which related objects get displayed in select boxes. For instance, the "photographer" field on the "Add photo" form only displays the "Staff members" that have shoots_photos=True.
django34: This results in some usability problems, though, because if a producer doesn't see a person's name in the list, he might click "Add another..." instead of checking to make sure the person isn't in "Staff members" and doesn't have "shoots_photos" checked.
django34: Does this make sense?
wilson: kind of
wilson: what page would that case appear on
django34: Here's an example...
django34: The "Photographer" select box includes *only* the staff members that have shoots_photos=True.
django34: So if a producer doesn't see a photographer in there, he might click "Add another...", which would create an entirely new staff member. But it might be the case that the staff member DOES exist, just doesn't have shoots_photos=True checked.
wilson: if the staff member did exist, would it let them add them again?
django34: Yes, as long as the slug was different.
django34: The only way I can think of to fix this would be to have some sort of "Showing only photographers [Show all staff members]" link. Or to eliminate the filtering altogether.
wilson: i was going to suggest a "show all staff" link
wilson: yes, that is my suggestion
wilson: "show all staff" link next to the select
wilson: then "show photographers only" when the filter is off
django34: All right.
Change History
(17)
Owner: |
changed from Adrian Holovaty to Wilson Miner
|
Triage Stage: |
Unreviewed → Design decision needed
|
Triage Stage: |
Ready for checkin → Design decision needed
|
Triage Stage: |
Design decision needed → Someday/Maybe
|
Version: |
→ SVN
|
Severity: |
minor → Normal
|
Type: |
defect → Bug
|
Resolution: |
→ wontfix
|
Status: |
new → closed
|
Let enough time go by and you will always disagree with yourself. I don't think my original suggestion is going to work here. "Show all staff" defeats the purpose of the limit in the first place.
The simplest solution is to just display a natural language description of the limit_choices requirements. But "Showing 53 staff members with takes photos set to true." isn't very user-friendly. Maybe this is just something that should be added to the help text for the field as a best practice?
Another problem is the fact that you can use "add another", create a new staff member that doesn't meet the limits and it won't show up. You could prefill the fields required to meet the limit in the add another popup (in this example, "takes photos" would be checked). That's not very transparent to the user, and it isn't clear that changing the prefilled fields will make your new object unavailable to the original relationship field.