V
V
vhsporno2020-04-21 12:50:27
Django
vhsporno, 2020-04-21 12:50:27

How to implement a filter in Django with duplicate IDs?

Good afternoon.
It is necessary to make it so that when I wrote: I was given a QS with two objects? Can you please tell me how to implement this?
Question.objects.filter(id__in=[1,1])

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dr. Bacon, 2020-04-21
@bacon

You probably also need to save the order, so first make a selection, and then, based on this list, create a new one, with values ​​from the selection

V
Vadim Shatalov, 2020-04-21
@netpastor

If the task is not to find duplicates, then union can probably help you
https://docs.djangoproject.com/en/2.2/ref/models/q...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question