2 ms·
You can set sorting order and filtering options in your admin class, but the UI doesn't provide clickable column headers or anything like a search box. EDIT: A
by snprbob86 17y ago
You can set sorting order and filtering options in your admin class, but the UI doesn't provide clickable column headers or anything like a search box.
EDIT: Apparently I was mistaken, as the replies point out. I read the Django book, but I do not recall this chapter. My apologies.
- jonknee 17y agoMaybe I am misunderstanding you, but it does do clickable column headers (by default even I think) and you can definitely have a search box.
- ubernostrum 17y agoBy default, any field on the model that's displayed as a column in the list of objects is clickable to sort. You can also display things based on other attributes of the model (e.g., calling a method), and if you like you can specify that they're tied to particular fields to get clickable sorting for those as well.
- sebg 17y agoI was going through the django book and here is something that could help you out: search_fields = ('title',) "Finally, the search_fields option creates a field that allows text searches. It allows searches by the title field (so you could type Django to show all books with “Django” in the title)." http://www.djangobook.com/en/1.0/chapter06/ http://www.djangobook.com/en/1.0/chapter06/
- jbronn 17y agoThe admin provides both of these features -- specify the columns you want to be clickable in the `list_display` attribute on your `ModelAdmin` class. Similarly, specify a `search_fields` attribute to add a search box for the columns you want to search. Why read the documentation or look for examples when you can write a blog post screed and post it on HN?