educreations/django-ormcache

Add kwarg to from_ids that allows results to be sorted

Closed this issue · 2 comments

e.g.

> MyModel.from_ids([3, 20, 10], keep_sorted=True)
[<MyModel id=3>, <MyModel id=20>, <MyModel id=10>]

Or maybe this should be the default?

I think it would make sense to always return the results in the same order as the ids provided, but a keyword argument also seems reasonable.

Yeah, making it remain sorted by default seems reasonable. Won't break anything either.