[Django] #32680: Django admin does not need to send PK and FK of inline model back in POST request on save

15 views
Skip to first unread message

Django

unread,
Apr 23, 2021, 12:47:14 PM4/23/21
to django-...@googlegroups.com
#32680: Django admin does not need to send PK and FK of inline model back in POST
request on save
-----------------------------------------+------------------------
Reporter: dave-kong | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
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?

--
Ticket URL: <https://code.djangoproject.com/ticket/32680>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 26, 2021, 7:22:37 AM4/26/21
to django-...@googlegroups.com
#32680: Add an option to display inlines as a table without forms.
-------------------------------+--------------------------------------
Reporter: Dave Kong | Owner: nobody
Type: New feature | Status: closed
Component: contrib.admin | Version: 2.2
Severity: Normal | Resolution: wontfix

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* type: Bug => New feature
* resolution: => wontfix


Comment:

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
[https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.readonly_fields
ModelAdmin.readonly_fields] and render related table on your own or ask on
one of
[https://code.djangoproject.com/wiki/TicketClosingReasons/UseSupportChannels
support channels] for other solutions.

--
Ticket URL: <https://code.djangoproject.com/ticket/32680#comment:1>

Reply all
Reply to author
Forward
0 new messages