Entries published in July 2006

9 entries published in this month. See also: all entries published in 2006, latest entries.

Django tips: A simple AJAX example, part 1

One thing that’s come up over and over again in the Django IRC channel and on the mailing lists is the need for good examples of “how to do AJAX with Django”. Now, one of my goals in life at the moment is to try to fill in the gaps in Django’s documentation, so…

Over the next couple of entries we’re going to walk through a very simple form, which will submit via AJAX to a Django view and handle the result without a page refresh. If you’d like, you ...

Entry published July 31, 2006. Read full entry.

Apropos of even less

One day real soon I’m going to start writing real blog entries again. But for the moment, I’m a bit too bogged down with various things, so I’m just going to continue sharing quick, amusing anecdotes.

Moments ago on IRC, Jeff posted one of the more amusing error messages we’ve ever come across:

tar: phpicalendar-2.22/phpicalendar/tmp/parsedcal-US%2520Holidays-2006: implausibly old time stamp 1969-12-31 16:00:00

Entry published July 25, 2006. Read full entry.

Apropos of nothing

So this morning we come in to work, and something’s wrong with all the chairs; they’ve been moved around or reset or something, because they’re not in their usual friendly-to-programmers-with-poor-posture configurations. We deal with it.

Until about thirty seconds ago, when Matt stood up and started trying out every empty chair in the office to see if he could find one that felt right. His reasoning:

Man, this Aeron’s throwing an ImproperlyConfigured!

Entry published July 24, 2006. Read full entry.

Helpers, scaffolding, tradeoffs and other stuff

In one of the very, very few coherent things I’ve seen him say in comments posted here and elsewhere, one Lucas Carlson brought up the other perceived advantage of JavaScript helpers: they save time:

Sure it is possible to add javascript helper functions to Django, and yes that would speed up initial development times and reduce bugs since Python is usually more terse than JS… even for expert JS programmers.

I’m going to ignore the “fewer bugs” argument because it seems to me that writing code in one language ...

Entry published July 17, 2006. Read full entry.

Django tips: Hacking FreeComment

Django’s bundled comments application (found in django.contrib.comments) is incredibly useful; it gives you a nice, out-of-the-box system for adding comments to any site. But, if you look at it closely, really feels more like two applications:

  1. The Comment model and its helpers, which only allows registered user accounts to post comments.
  2. The FreeComment model and its helpers, which allows anyone at all to post comments.

The first one — based around Comment — is much more complex by far, and includes pretty much everything World Online has ever needed for ...

Entry published July 16, 2006. Read full entry.

Independence Day

In CONGRESS, July 4, 1776.

The unanimous Declaration of the thirteen united States of America,

When in the course of human Events, it becomes necessary for one People to dissolve the Political Bands which have connected them with another, and to assume among the Powers of the Earth, the separate and equal Station to which the Laws of Nature and of Nature’s God entitle them, a decent Respect to the Opinions of Mankind requires that they should declare the causes which impel them to the Separation.

We hold these Truths to be ...

Entry published July 4, 2006. Read full entry.

JavaScript, ORM and “hiding SQL

So my little rant on AJAX support in Django apparently touched a nerve with a couple people; that means it’s time to write more about it.

One of the common points people have been raising, in comments and elsewhere, is that I shouldn’t rail against “hiding JavaScript from the developer” when Django’s ORM already hides SQL from the developer; from the perspective of a server-side developer, SQL is just as important, right?

Yes, SQL is just as important. But having ORM isn’t “hiding SQL”.

What ORM is

The intialism “ ...

Entry published July 4, 2006. Read full entry.

Django tips: scaling an application

In today’s ripped-from-the-mailing-list Django tip, we’ll be looking at a common scaling pattern: an application which starts out with one user, then has to gain separate “instances” for each of multiple users. And for bonus goodness, we’ll scale it even further to work on multiple sites simultaneously.

Let’s build a blog

For purposes of this example, let’s say that you’re building a blog with Django; that was the example in the mailing-list thread, so I’ll run with it, but there are lots of types of applications that could go through this process.

When ...

Entry published July 3, 2006. Read full entry.

Django and AJAX

One hot topic that keeps coming up over and over again on the Django mailing lists and in IRC has to do with when Django will get “AJAX support”. There are two answers to that question; one can be stated with authority, and the other consists entirely of my own unofficial and non-binding opinion. Let’s start with the first:

We’ve already got it, and more is on the way

Doing AJAX with Django has always been pretty easy, though maybe in a way that’s not obvious to users of other frameworks ...

Entry published July 2, 2006. Read full entry.