Sometimes, we want to select DISTINCT individual columns in Python Django.
In this article, we’ll look at how to select DISTINCT individual columns in Python Django.
How to select DISTINCT individual columns in Python Django?
To select DISTINCT individual columns in Python Django, we can use the distinct method.
For instance, we write
ProductOrder.objects.all().distinct('category')
to call distinct to select all ProductOrder objects with the distinct category field values.
Conclusion
To select DISTINCT individual columns in Python Django, we can use the distinct method.