20👍
✅
Use distinct()
i.e.:
Blog.objects.filter(entries__title__contains='entry').distinct()
http://docs.djangoproject.com/en/dev/ref/models/querysets/#distinct
5👍
Use the distinct method
Blog.objects.filter(entries__title__contains='entry').distinct()
- Django admin, section without "model"?
- How do I extend UserCreationForm to include email field
- Django redirect to another view with context
Source:stackexchange.com