inefficient design of inlinemodeladmin
|Reported by:||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The problem we are trying to highlight is that with larger datasets, the inline admin is extremely inefficient and becomes impossible to work with. It loads the ENTIRE dataset and dumps it into the page as options. This is fine for small-ish data-sets, but unworkable with bigger ones.
We have created a small project on github to demonstrate this issue https://github.com/Azd325/django-admin-inline-bug
This was tested with Django 1.2.5 as well as the latest trunk and produces the same results.
The project includes code taken directly from the Django documentation, with no further changes. i.e.
We have used the Person<->Membership<->Group many-to-many model. The initial data (included in the fixtures) creates 10,000 Person records on the database, with a single Group object, of which there is only one member currently.
Managing the group via django admin (e.g. /admin/big_group/group/1/) shows that the page includes ALL people, regardless of group membership, as a HTML select.
The HTML would include this:
<select name="membership_set-0-person" id="id_membership_set-0-person"> <option value="">---------</option> <option value="1" selected="selected">Person object</option> <option value="2">Person object</option> <option value="3">Person object</option> ... <option value="9999">Person object</option>
and it does it not only once, but as many times as there are members. So if you have a 10,000 person records, with 100 members of a group, changing the group membership via the django admin would load 1,000,000 records into the HTML.
Perhaps the inline design should change to only load the right objects that are part of the relationship (with an option to add/delete/modify). Otherwise, maybe the documentation should highlight this potential issue, so users of django admin inlines are aware of it.
Tim Kleinschmidt + Yoav Aner
Change History (4)
comment:1 Changed 6 years ago by
|Patch needs improvement:||unset|
|Status:||new → closed|