Opened 11 years ago
Closed 11 years ago
#24185 closed Uncategorized (duplicate)
Inline object in TabularInline.get_readonly_fields
| Reported by: | Zach Borboa | Owned by: | nobody | 
|---|---|---|---|
| Component: | contrib.admin | Version: | dev | 
| Severity: | Normal | Keywords: | |
| Cc: | Zach Borboa | Triage Stage: | Unreviewed | 
| Has patch: | no | Needs documentation: | no | 
| Needs tests: | no | Patch needs improvement: | no | 
| Easy pickings: | no | UI/UX: | no | 
Description
The TabularInline.get_readonly_fields method should be able to programmatically determine the fields that will be displayed as read-only based on the inline object passed as the keyword argument instance_obj.
ModelAdmin.get_readonly_fields(request, obj=None)
obj is not the inline object, it's the parent. Ideally, both the parent and the inline object are available:
ModelAdmin.get_readonly_fields(request, obj=None, instance_obj=None)
  Note:
 See   TracTickets
 for help on using tickets.
    
Also discussed here
https://code.djangoproject.com/ticket/15602#comment:8
http://stackoverflow.com/questions/6727372/get-readonly-fields-in-a-tabularinline-class-in-django