Entries published in July 2006

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

Django tips: A simple AJAX example, part 1

Published July 31, 2006

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

Read full entry and comments

Mandy, I’m dandy

Published July 28, 2006

I don’t honestly expect any of you to remember this, but some time ago, when I posted an entry talking about Python and Ruby (on which comments are closed because the post is over a month old — hopefully this weekend I’ll get around to turning on the auto-moderation stuff I wrote up), I received a comment from one “Mandy Owens”, who seemed to think that, for both technical and marketing reasons, Rails makes Ruby the better choice.

I replied and disagreed with several of her points, because I ...

Read full entry and comments

Apropos of even less

Published July 25, 2006

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

Read full entry and comments

Apropos of nothing

Published July 24, 2006

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!

Read full entry and comments

Helpers, scaffolding, tradeoffs and other stuff

Published July 17, 2006

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

Read full entry and comments

Django tips: Hacking FreeComment

Published July 16, 2006

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

Read full entry and comments

Independence Day

Published July 4, 2006

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

Read full entry and comments

JavaScript, ORM and “hiding SQL

Published July 4, 2006

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

Read full entry and comments

Django tips: scaling an application

Published July 3, 2006

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

Read full entry and comments

Django and AJAX

Published July 2, 2006

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

Read full entry and comments