Answer the question
In order to leave comments, you need to log in
How to remove duplicates in Django?
I have a model with fields area (region), city (city), district (district). There are other fields, but we are not talking about them. How to correctly select all records from the table that are unique in these three fields (what the id value will be is not important to me)? .values('area', 'city', 'district').distinct() doesn't work because I need all the columns of the table, not just those listed in values. Maybe you can somehow group by these 3 fields, but without annotate (because I don't need aggregation)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question