I spent a lot of time with distinct () wondering why it doesn’t work. Then I decided to change order_by ('?') From order to order_by ('name') from the bald and it worked surprisingly well.
Perhaps distinct () when random sorting does not understand what to compare, I am not aware of its principle of operation, but I would like to somehow make it work.
Perhaps there is a substitute for random sorting through order_by ('?') And so that it works well with distinct ().
In general, I need help. Help me please.
Oh, I almost forgot. DB - SQLite, the site itself on Django.
DISTINCTstatement in SQL requires sorting. Therefore, to combine you will not work. - Sergey Gornostaev