Opened 19 years ago
Last modified 15 years ago
#607 closed enhancement
IDEA: admin option to show/hide fields — at Initial Version
Reported by: | Wilson Miner | Owned by: | Adrian Holovaty |
---|---|---|---|
Component: | contrib.admin | Version: | |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Concept: An admin option that specifies a list of fields to show/hide based on the value of another field.
Example: An "I like cake" checkbox that, when checked, shows two previously hidden text fields "Favorite cake" and "Favorite frosting".
Code Example:
admin.switch = ('likes_cake', True, ['favorite_cake', 'favorite_frosting'])
You could also tie this to a particular value of a select field:
admin.switch = ('gender', {'M': ['favorite_sport'], 'F': ['favorite_soap_opera']})
Unsolved issues:
- Need some place to specify the initial state of the targeted fields (visible or hidden). Default (and most common case) would be hidden, but there are cases where this needs to be reversed.
- All hiding and should happen in javascript, so fields don't get hidden that can't be turned back on with javascript disabled. The switch option could also tie into the validation framework so unnecessary fields (meant to be hidden) don't get filled in even when javascript is off.
- Any other ideas?
Note:
See TracTickets
for help on using tickets.