Login

Tag "changelist"

Snippet List

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
Read More

Accordion changelist admin

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).

  • filter
  • hide
  • collapse
  • changelist
  • list_filter
  • accordion
  • collapsible
Read More
Author: djm
  • 2
  • 3

Admin: ordering by multiple fields in a column sort

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)

  • admin
  • ordering
  • changelist
Read More

Accordion changelist admin

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"

  • admin
  • changelist
Read More

Increase maximum number of changelist items for "Show all" link to appear

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.

  • admin
  • changelist
Read More

7 snippets posted so far.