Entries published in July 2006
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 ...
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
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
Helpers, scaffolding, tradeoffs and other stuff
I’m going to ignore the “fewer bugs” argument because it seems to me that writing code in one language ...
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:
Commentmodel and its helpers, which only allows registered user accounts to post comments.
FreeCommentmodel 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 ...
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 ...
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.
Yes, SQL is just as important. But having ORM isn’t “hiding SQL”.
What ORM is
The intialism “ ...
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.
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 ...