Quantcast
Channel: How to combine multiple querysets in Django? - Stack Overflow
Viewing all articles
Browse latest Browse all 32

Answer by bryan for How can I combine two or more querysets in a Django view?

$
0
0

Try this:

matches = pages | articles | posts

It retains all the functions of the querysets which is nice if you want to order_by or similar.

Please note: this doesn't work on querysets from two different models.


Viewing all articles
Browse latest Browse all 32

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>