Is there any way to change the ordering of search results when using search_fields
in your admin.py
?
Here is what I have so far:
# models.py
class Book(models.Model):
# ...
name = models.CharField(...)
description = models.TextField(...)
and:
#admin.py
class BookAdmin(admin.ModelAdmin):
# ...
search_fields = ('name', 'description')
Then when I search something in the admin page django aggregate many results from both name
and description
and returns it in an order which I can't find out. I simply want to sort the results from name
before the ones from description
.
Is there anyway to do this in django?