django-admin2 icon indicating copy to clipboard operation
django-admin2 copied to clipboard

Implement ModelAdmin2.list_editables

Open pydanny opened this issue 11 years ago • 8 comments

Warning: Thanks to research done by @oinopion on Django core we know that we have to completely rewrite how django.contrib.admin provides this functionality. The problem is that which record(s) gets edited is currently tracked by list order, not by a consistent record identifier. This makes any serious use of the current django.contrib.admin list_editables system extremely risky.

pydanny avatar Jun 09 '13 18:06 pydanny

Is this a shortcoming in using model formsets in general, or just the way the admin does it?

AndrewIngram avatar Jun 09 '13 18:06 AndrewIngram

That is just django admin, formsets will happily work with PKs.

oinopion avatar Jun 09 '13 18:06 oinopion

Seems like my ModelFormSetView in django-extra-views (which we already have as a dependency) will do most of the work for us then. The current blocker is that Django's existing CBVs make it really awkward to paginate formsets, I was talking with @mjtamlyn about ways to address this, so it'd be good to get him involved.

AndrewIngram avatar Jun 09 '13 18:06 AndrewIngram

Do we want to do pagination directly in normal CBVs or rely instead on django-rest-framework queries. I lean towards the latter.

pydanny avatar Jun 09 '13 18:06 pydanny

Pagination brings me to other issue with django.contrib.admin which is that default django Paginator relies on COUNT(*) which has very bad performance.

oinopion avatar Jun 09 '13 18:06 oinopion

We can address the performance issue by being dogmatic and only allowing next/previous pagination and using the greater-than trick.

AndrewIngram avatar Jun 09 '13 18:06 AndrewIngram

Performance is a grave concern for us. We want to avoid django.contrib.admin's issues and have speed. One of the really nice things about django-mongonaut is that it performs well under load.

pydanny avatar Jun 09 '13 18:06 pydanny

:+1: for next/previous pagination, as proposed by @AndrewIngram

douglasmiranda avatar Jun 09 '13 20:06 douglasmiranda