FWIW there's ungoing work to allow iterator() to use prefetch_related() 
which would allow us to lift this restriction.

See 
https://groups.google.com/forum/#!searchin/django-developers/iterator$20prefetch%7Csort:date/django-developers/ADgUd6jRvdw/_ZnETNlcAAAJ

Cheers,
Simon

Le jeudi 11 juin 2020 08:59:09 UTC-4, 1337 Shadow Hacker a écrit :
>
> We've decided to open a ticket and MR for it: 
> https://github.com/percipient/django-querysetsequence/issues/67 (that 
> would happen this weekend)
>
> If there's any objection please let us know.
>
> Have a great day
>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> Le mardi, avril 28, 2020 6:39 PM, 1337 Shadow Hacker <
> 1337s...@protonmail.com <javascript:>> a écrit :
>
> Sorry I sent the mail prior to finishing, redoing fully from here: 
>
> I notice a piece of code inside ModelChoiceIterator that seems to keep 
> going a bit back and forth, currently it looks like this:
>
>         # Can't use iterator() when queryset uses prefetch_related()
>         if not queryset._prefetch_related_lookups:
>             queryset = queryset.iterator()
>
> But before it looked like this:
>
>         # Can't use iterator() when queryset uses prefetch_related()
>         if not queryset._prefetch_related_lookups and 
> queryset._result_cache is None:
>              queryset = queryset.iterator()
>
> Anyway, if you want to implement your own QuerySet class from scratch, 
> which is the case of django-querysetsequence, and that's pretty useful to 
> feed ModelChoiceFields, as long as you prefix object ids with content type 
> ids which is pretty trivial.
>
> Do you think it would be acceptable to start an effort with the objective 
> of making django.forms.models rely purely on a public API of QuerySet ?
>
> In this case, how would you accept to see that changed ?
>
> Thanks in advance
>
> Have a great day
>
>
>

-- 
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-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/831990fa-95fa-421a-a61a-95b1097cf8f6o%40googlegroups.com.
  • ... '1337 Shadow Hacker' via Django developers (Contributions to Django itself)
    • ... '1337 Shadow Hacker' via Django developers (Contributions to Django itself)
      • ... '1337 Shadow Hacker' via Django developers (Contributions to Django itself)
        • ... charettes
          • ... '1337 Shadow Hacker' via Django developers (Contributions to Django itself)
            • ... charettes
              • ... '1337 Shadow Hacker' via Django developers (Contributions to Django itself)

Reply via email to