You will want to sort most of the models in your database by creation date, happening date, or alphabetically. But sometimes, the user has to be able to show items in a custom sorting order. This applies to categories, image galleries, curated lists, and similar cases. In this recipe, we will show you how to use django-ordered-model to allow custom sorting in administration.
Creating sortable inlines
Getting ready
In this recipe, we will build upon the products app that we defined in the previous recipe. Follow these steps to get started:
- Let's install django-ordered-model in our virtual environment:
(env)$ pip install django-ordered-model
- Add ordered_model to INSTALLED_APPS in the settings.
- Then, modify the ProductPhoto...