[Answer]-List in local working fine but in server works inverse

1👍

For the first, I don’t see why this would be a problem. What is it you’re trying to solve here? Why do you need the ID list ordered?

Anyways, to always get the list ordered by IDs, you can simply use the order_by on your query, to always return the list ordered by the ID number:

qs = CreditoPredio.objects.filter(predio_id=self.kwargs['predio_id']).order_by('id')

I don’t know why you’re results are different. Are your local installation the exact same as Heroku? Are the data entered in the exact same order? If not, you can’t assume that your local version will run 100% exactly like on Heroku.

Leave a comment