How to write python list inclusions to remove duplication

Asked 2 months ago, Updated 2 months ago, 2 views

Get a query_set and
Due to duplicate values in hoge column,
I would like to eliminate duplicates.
I'd like to write this in a list format. How should I write it?

pass_hoge_list = [ ]
for i in list(query_set):
  if not i.get(hoge) in pass_hoge_list:


2022-09-30 14:09

1 Answers

 {i.get("hoge"):i for i in query_set}.values()

Is it like this?

2022-09-30 14:09

If you have any answers or tips

© 2022 OneMinuteCode. All rights reserved.