Created
April 24, 2020 05:56
-
-
Save sanjaykrishnan/d5344e7fe69d9663fc8b1fa0b2b7bb66 to your computer and use it in GitHub Desktop.
MP Node Ordering
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
qs = ProductCategory.objects.all() | |
slug_list = [item['slug'] for item in cat_list if item['slug'] in qs_slugs] | |
preserved = Case(*[When(slug=slug, then=pos) for pos, slug in enumerate(slug_list)]) | |
qs= qs.order_by(preserved) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment