djangosnippets.org: Latest snippets tagged with 'compact'https://djangosnippets.org/tags/compact/2017-08-22T07:08:37.450955-05:00Compact primary keys
2017-08-22T07:08:37.450955-05:00bernd-wechnerhttps://djangosnippets.org/snippets/10620/<p>If the primary key on a table is an integer, it can be desirable after a lot of adding and removing either during testing (as was my case) or otherwise, to tidy up the key space a little and see the primary keys run up as unbroken sequences from 1. …</p>
Freely redistributableGeneric compact list_filter with counts
2012-01-12T14:06:03.612043-06:00anentropichttps://djangosnippets.org/snippets/2644/<p>Based on <a href="http://djangosnippets.org/snippets/1879/">#1879</a> and <a href="http://djangosnippets.org/snippets/2356/">#2356</a></p>
<p>Works in Django 1.3</p>
<p>Hopefully it's generic enough to implement a compact (sparse) version of whatever custom filter you need.</p>
Freely redistributableCompact list_filter with counter
2011-02-15T04:36:00.157480-06:00fab10mhttps://djangosnippets.org/snippets/2356/<p>This is an extension of the fantastic snippet "Compact list_filter" written by <strong>onlinehero</strong>. Follow his instructions for the installation.
My version add the number of filtered objects beside the label of the filters defined by the list_filter property.
</p>
Freely redistributableCompact list_filter
2010-01-21T15:06:32.443710-06:00onlineherohttps://djangosnippets.org/snippets/1879/<p>When doing a list_filter on some object in the Django interface, every single item will be displayed. This is not always smart when very long list of choices can be displayed, even though the majority of these choices might not even exist in the database at all.
</p>
<p>Using this script …</p>
Freely redistributableDjango view and url in one function
2009-10-01T10:23:34.852938-05:00oduvanhttps://djangosnippets.org/snippets/1750/<p>application 'someapp' don't have urls.py file, all information about urls placed as decorator for view function</p>
<p>PS: Added functools.wraps</p>
Freely redistributable