K
K
Konstantin Malyarov2018-03-31 18:58:22
Django
Konstantin Malyarov, 2018-03-31 18:58:22

How to get the last entry for an ID range in Django?

This way does not work

patients_id = [1, 2, 5, 3, 9]
            return Operation.objects.last(patient__in=patients_id)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2018-03-31
@Konstantin18ko

Operation.object.filter(patient_id__in=patients_id).order_by('id').last()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question