Bookmark No comments

Django tip: Caching and two-phased template rendering | Holovaty.com

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


Bookmark No comments

Django NamePaginator snippet

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.


Bookmark No comments

Haystack - Search for Django

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.


The Blog 10 comments

On the redesign

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

Continue reading...

Bookmark No comments

Simple Django Debugging Tools

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?


Bookmark No comments

Users and the admin

James Bennett describes how to ensure that people can only see/edit things they “own” (i.e., that they created) in the Django admin. Also covers how to automatically set a foreign key to User with request.user.


Bookmark No comments


Brian Beck’s django-batchadmin enables batch deletion in the Django admin, as well as other, custom batch processes.


Bookmark No comments

Drag & Drop reordering in Django Admin

Simon Willison’s snippet to allow drag & drop reordering of items in the Django admin.