AvaliabilityAtDateListFilter
If your model have two dates, start and end of something, you may want to have filter which allow you to show objects which last on specific day.
- filter
- admin
- changelist
- list_filter
If your model have two dates, start and end of something, you may want to have filter which allow you to show objects which last on specific day.
With this function if you filter using regular admin filters you'll reduce the queryset to the objects in view.
Please provide suggestions on refining this code. Thanks.
This is adapted from [rodnsi's version](http://djangosnippets.org/snippets/1818/) to work with Django 1.2 (as django.contrib.admin came with jQuery built in as of 1.2).
The new changelist supports clicking on a column header to order by that column, like iTunes. Unlike iTunes, which sorts by track number if you click the Artist or Album column header, it can only order by the column clicked on. By adding a property to my ModelAdmin, and subclassing ChangeList, I was able to make it also sort by track number when sorting by Artist or Album. [Blog post](http://python-web.blogspot.com/2010/07/sorting-by-more-than-one-field-in-admin.html) [Repository with full example](http://github.com/benatkin/tuneage)
Allows you to hide the filters in the pages of lists of admin. Very useful when filters hide one or more columns. Add this code after the block "extrastyle"
By default, a "Show all" link will appear in the changelist pager only if fewer than 200 records are in the result. Since it is rare that there will be more than one page of records yet fewer than 200, the "Show all" link almost never shows up. Pasting this code somewhere in your app will allow you to increase the 200-record maximum. "Show all" is very handy when used in combination with batch actions and filters, and this change will enable it for most situations. Note that this allows a changelist with up to 10,000 results, which results in a lot of HTML that can tax slower browsers and older machines. For me, it has been worth the tradeoff, since my users have fast enough computers and need to be able to make batch changes efficiently.
7 snippets posted so far.