[Fixed]-Django QuerySet filter method returns multiple entries for one record

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()

Leave a comment