model – How to change ordering in foreign key fields in django admin change_form – Education Career Blog

I have two tables, tasks and projects. And every task has a project (and every project can have N tasks).

When adding or editing a task, projects are displayed as dropdown as it should, but dropdown is ordered by ID (or no ordering at all). Because i start to have plenty of projects, is there a way to get projects in a dropdown in alphabetical order?

,

The objects should be ordered according to the default ordering specified on their model!

Leave a Comment