I was thinking of providing a package containing a couple of DRF renderers that work directly from querysets. DRF Serializers are great when you need to render a hierarchical structure, and/or when you expect to parse a POST body containing the structure. For returning non-hierarchical results, querysets ought to be fine. when I attempted to code this up, I realized that I needed for the renderer to know which fields are in the body to write a CSV or XLSX. I eventually decided that the renderers would assume that their input queryset was a values or values list queryset.
There is also the issue of simply being more DRY within Django itself - multiple Iterables combine list(values_select) + list(annotation_select) + list(extra_select), so a general public function could make that could slightly better.
It isn't too bad to look at _iterable_class - it just is clearly not a public interface.
On Friday, November 2, 2018 at 1:34:07 PM UTC-4, Tim Graham wrote:.
Could you explain the use case for the code that needs to handle the different types of iterators? list