2👍
✅
Have you tried this?
return self.request.basket.all_lines().order_by('product__upc')
0👍
How about using python’s sorted
method?
sorted(self.request.basket.all_lines(), key=lambda x: x.product.upc)
- [Answered ]-Store two types of value in single Django model field
- [Answered ]-Django: Update object from view, with no model or template
- [Answered ]-Calling Model function in template not working
- [Answered ]-I am attempting to add two models from separate local apps into one template
Source:stackexchange.com