"ORDER BY not allowed in subqueries of compound statements." in Django while using Icontains to join two querysets, problem comes when i join a third query set Such as slug with some special characters
My Views;
if len(query)>78:
myposts = Blogpost.objects.none()
else:
post_title = Blogpost.objects.filter(title__icontains=query)
posts_content = Blogpost.objects.filter(content__icontains=query)
posts_overview= Blogpost.objects.filter(overview__icontains=query)
myposts = post_title.union(posts_content, posts_overview)
if myposts.count() == 0:
messages.warning(request, "No search results found. Please enter again.")
context = {'myposts': myposts,'query':query}
return render(request, 'blog/search.html', context)```
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…