admin: implementing list_prefetch_related

202 views
Skip to first unread message

Riccardo Magliocchetti

unread,
Dec 30, 2015, 5:26:13 AM12/30/15
to django-d...@googlegroups.com
Hello,

the need to list an m2m relationship serialized in the admin list view happens
quite often to me and overriding the queryset may not be as trivial as a
ModelAdmin attribute. It makes sense to me to match what is possible with
foreign keys and list_select_related.
Any opinion on implementing list_prefetch_related for ModelAdmin?

--
Riccardo Magliocchetti
@rmistaken

http://menodizero.it

Marc Tamlyn

unread,
Dec 30, 2015, 6:31:06 PM12/30/15
to django-d...@googlegroups.com

Hi Richard,

Overriding the queryset is a pretty simple method override, I'm not sure there is sufficient need for prefetching here. In particular, the syntax for prefetch related is much more complex than for select related, so it's less well suited to this kind of shortcut.

Marc

--
You received this message because you are subscribed to the Google Groups "Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/5683B12D.6000600%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Riccardo Magliocchetti

unread,
Dec 31, 2015, 4:44:00 AM12/31/15
to django-d...@googlegroups.com
Hi Marc,

fine, was thinking on supporting just the simple case without the Prefetch object.

Il 31/12/2015 00:30, Marc Tamlyn ha scritto:
> Hi Richard,
>
> Overriding the queryset is a pretty simple method override, I'm not sure there
> is sufficient need for prefetching here. In particular, the syntax for prefetch
> related is much more complex than for select related, so it's less well suited
> to this kind of shortcut.
>
> Marc
>
> On 30 Dec 2015 10:26 a.m., "Riccardo Magliocchetti"
> <riccardo.ma...@gmail.com <mailto:riccardo.ma...@gmail.com>> wrote:
>
> Hello,
>
> the need to list an m2m relationship serialized in the admin list view
> happens quite often to me and overriding the queryset may not be as trivial
> as a ModelAdmin attribute. It makes sense to me to match what is possible
> with foreign keys and list_select_related.
> Any opinion on implementing list_prefetch_related for ModelAdmin?
>
> --
> Riccardo Magliocchetti
> @rmistaken
>
> http://menodizero.it
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-develop...@googlegroups.com
> <mailto:django-developers%2Bunsu...@googlegroups.com>.
> To post to this group, send email to django-d...@googlegroups.com
> <mailto:django-d...@googlegroups.com>.
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to django-develop...@googlegroups.com
> <mailto:django-develop...@googlegroups.com>.
> To post to this group, send email to django-d...@googlegroups.com
> <mailto:django-d...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/CAMwjO1ECoZGJEkGttZtAZeSBUktHRoYCX_hOj-1ehYtGCRSLzw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-developers/CAMwjO1ECoZGJEkGttZtAZeSBUktHRoYCX_hOj-1ehYtGCRSLzw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.


Reply all
Reply to author
Forward
0 new messages