Changes between Version 1 and Version 3 of Ticket #32685
- Timestamp:
- Apr 26, 2021, 6:40:37 AM (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #32685
- Property Component Uncategorized → Database layer (models, ORM)
- Property Resolution → wontfix
- Property Status new → closed
- Property Type Uncategorized → New feature
-
Ticket #32685 – Description
v1 v3 20 20 from django.db.models import Case, When 21 21 22 preserved = Case(*[When(my_field=val, then=pos) for pos, val in enumerate(my_values)] )22 preserved = Case(*[When(my_field=val, then=pos) for pos, val in enumerate(my_values)], default=len(my_values)) 23 23 queryset.filter(my_field__in=my_values).order_by(preserved) 24 24 }}}