#32680 closed New feature (wontfix)

Add an option to display inlines as a table without forms.

Reported by: Dave Kong Owned by: nobody
Component: contrib.admin Version: 2.2
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I have Inline models that lists a lot of rows, and on save, it causes an error due to DATA_UPLOAD_MAX_NUMBER_FIELDS being exceeded. I can increase this setting to a much larger number, but that reduces the benefit of it to catch SuspiciousOperations.

The thing is that all the inline model fields are read-only. I also tried to mark them using has_change_permission override to false. It also has

extra = 0
    max_num = 0
    can_delete = False

so no new can be added or deleted. but that didn't seem to work. I still see in POST request all the PK (and FK) being sent like below.

orders-0-id: 6769275
orders-0-customer: 165326
orders-1-id: 6658512
orders-1-customer: 165326
orders-2-id: 6550069
orders-2-customer: 165326
orders-3-id: 6446255
orders-3-customer: 165326

Is there any reason these need to be sent if inline model is readonly through and through? Or is there a way to mark inline as completely readonly?

Change History (1)

comment:1 Changed 21 months ago by Mariusz Felisiak

Resolution: wontfix
Status: newclosed
Summary: Django admin does not need to send PK and FK of inline model back in POST request on saveAdd an option to display inlines as a table without forms.
Type: BugNew feature

Admin inlines are for editing models on the same page as a parent model not for displaying extra details, what as far as I'm aware your trying to achieve.

You can try to use ModelAdmin.readonly_fields and render related table on your own or ask on one of support channels for other solutions.

Note: See TracTickets for help on using tickets.
Back to Top