Answer the question
In order to leave comments, you need to log in
How to select only unique objects from queryset?
My current query returns a list of objects, each of which has a key pair 'day': 1. 'day': 2, and so on. but they are repeated.
<<QuerySet [{'id': 217186, 'day': '1'}, {'id': 217187, 'day': '1'}, {'id': 217188, 'day': '1'}, {'id': 217189, 'day': '1'}, {'id': 217190, 'day': '1'}, {'id': 217191, 'day': '1'}, {'id': 217192, 'day': '1'}, {'id': 217193, 'day': '1'}, {'id': 217194, 'day': '1'}, {'id': 217195, 'day': '2'}, {'id': 217196, 'day': '2'}, {'id': 217197, 'day': '2'}, {'id': 217198, 'day': '2'}, {'id': 217199, 'day': '2'}, {'id': 217200, 'day': '2'}, {'id': 217201, 'day': '2'}, {'id': 217202, 'day': '2'}, {'id': 217203, 'day': '2'}, {'id': 217204, 'day': '3'}, {'id': 217205, 'day': '3'}, '...(remaining elements truncated)...']>
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