Adrian Holovaty describes a clever technique they use at Everyblock to render templates in two phases — the first to generate and cache the expensive, data-intense part of the site; the second to render the final, uncached bits (the “You’re logged in as…” bit). Includes code
Here’s a very cool pagination snippet that allows you to create an alphabetical list of objects like: Browse by title: A-G | H-N | O-Z. NamePaginator works almost exactly like Django’s Paginator: you pass in a list of objects and how many you want per letter range and it dynamically generates the pages so that there are approximately that many objects per page. I wish this were a full-fledged app, like django-pagination, with all the features of that app, but this is a great start and a very useful bit of functionality.
Haystack, Daniel Lindsley’s search app for Django, looks like a perfect addition to my Django toolkit. The API matches how Django’s admin works, trading indexes.py for admin.py and autodiscovering indexes in the same way manner. Supports a variety of backends, including Solr.
Worksology is back! You’ve missed me, yes?
This redesign has taken more than three years to come to fruition. In the meantime, the site has been either completely broken or nothing more than a cold “on hiatus” message. In fairness, I’ve been busy: getting engaged & married, settling into ...
My two biggest weaknesses in Django development are debugging and testing. Malcolm lays down some simple tools, already built into Django, to help with the former. I’ve always found a way around these issues, but these are exactly the tools I should have been using. Very glad to have these pointed out. I would still like to see someone lay out exactly how to debug SQL queries, since I have no inkling the right number of SQL queries for a particular kind of page. How do you spot issues? What number of SQL queries is clearly too many?
Brian Beck’s django-batchadmin enables batch deletion in the Django admin, as well as other, custom batch processes.