Content by tag: "django"

TimeToLead

jp.stacey 12 April 2010 TimeToLead

Django internal architecture: a nice PDF

jp.stacey 15 June 2009
Get that blasted workflow away from me, you fiends.

I've never been completely happy with this spindly and slightly confusing diagram from the Django Book, ever since it appeared the first edition.

Google now lets you pay for Google App Engine

jp.stacey 25 February 2009
But can you buy the bits you want to deploy a Django application?

Google are introducing paid-for extensions to Google App Engine quotas, which is great as it lets you build more complex applications if you're willing to pay the rates. At the same time they're reducing the baseline free quotas.

Serious Geeking Going on in Oxford Over Online Publishing

jp.stacey 16 November 2008
For those of you that weren't at OGN9, here's a belated summary. Videos are up on the site if you're interested.

A summary of OGN9, originally on the Google Open Source Blog:

On Wednesday 22 October, over a hundred geeks attended the ninth Oxford Geek Night, upstairs at the Jericho Tavern.

The TimeToLead.eu technical stack: Django and Flex

jp.stacey 11 September 2008
Move over LAMP: here comes LAPD.

As discussed previously, at Torchbox we recently built TimeToLead.eu, an advocacy site set up by the four major environmental NGOs to prompt MEPs into passing the sort of legislation the world's climate desperately needs. The project itself needed a fast turnaround time, and its pan-European audience demanded strong i18n and l10n.

Random ordering of query results in Django

jp.stacey 3 September 2008
Those who can, Google; those who can't, teach Google.

In Django, when you have a queryset---a set of objects returned by an object manager, as yet not evaluated to actual objects---and you want them ordered randomly, set your order_by parameter to be a string of a single question mark:

>>> from mysite.models import Country
>>> Country.objects.order_by('?')
>>> Country.objects.filter(continent='Europe').order_by('?')

The objects should then be iterable in a random order.

Astonishingly, the existing documentation has very little Goo

Playing with Django: a fretless experience

jp.stacey 25 August 2008
I've been trying for twenty minutes to shoehorn a joke about Grappelling into this excerpt.

Django continues to gather momentum towards its imminent 1.0 release. The 1.0 beta 1 is out; the developer documentation has been refactored; it already places nicely with Python's powerful debugging and logging tools; indeed, all is proceeding according to the roadmap, more or less.

Django's ViewDoesNotExist Heisenbug

jp.stacey 8 June 2008
Django's fusebox sometimes blows one, if you start poking around in it with a template-tag screwdriver.

To the untrained eye, you might think that you can put any old string in as the second element of one of your Django URL dispatcher patterns in urls.py:

Variable assignment in Django templates, sort of

jp.stacey 29 May 2008
Use and abuse of the "with" programmatic statement to make your Django template code less mad.

Django’s templating language is intentionally quite restrictive. The idea is that you have to do all your data munging in the control-ish sublayer of the view layer, in the method registered as handling the view in urls.py. In principle this simplifies templates, but in practice it can make life for the developer more difficult: you have to really think ahead, and assemble your variables properly, so that the templating language can use simple iterative loops to prepare your HTML.

logging.debug("if only I'd known")

jp.stacey 22 May 2008
logging.debug("if only I'd known") logging.debug("if only I'd known") /* is there any way to turn this off? */ logging.debug("if only I'd known") ....

I wish Simon Willison had written about Django logging and debugging earlier than today. That way I wouldn’t have used the slightly daft solution I describe in the comments.

Of course, much earlier than today, and he’d have had to have written it before giving the talk that it was based on, which might sound a bit demanding on my part. But hey! I don’t make the rules.