Django, AJAX, Scriptaculous

I looked a little at Scriptaculous this weekend.  I like it–it seems easy to use, and nice and concise.  It’s more focussed on glitzy effects (and I mean that in a good way) and less on widgets than the much larger DOJO; it also struck me (quite possibly wrongly, I’m just at the poking around stage) as easier to figure out and use.  Both effects and AJAX requests are wrapped pretty nicely; you have to write very little code to use them.

Unlike DOJO it does pollute the global js namespace a bit (as mentioned here); that might be annoying for people planning to use more of their own js than I’m ever likely to.

Here‘s what appears to be a nice scriptaculous-in-django tutorial, not that I’ve gone through it in any detail.

There seems to have been much debate in Django circles about whether to “include AJAX” in Django, which would (I assume) mean bundling a toolkit and providing a set of tags that wrap it, a la Rails and Scriptaculous.  The Django developers are reluctant to do that, not wanting to commit to a toolkit, and pointing out that there’s really not that much to wrap.  Now that I at least know what they’re talking about, I can sorta see their point.  Which doesn’t mean a some rails-like toolkit-wrapping tags wouldn’t be nice.
I’m working (in a slow and desultory fashion) on something where I might actually make some use of this stuff; so maybe I’ll be able to form an informed opinion in a few weeks.

Tags: , ,

5 Responses to “Django, AJAX, Scriptaculous”

  1. Alex Says:

    For fun, I’ve put up rails code that provides similar functionality. Needless to say, the rails code is more elegant 😛

    http://codingfrenzy.alexpmay.com/2008/01/ajax-django-ror.html

  2. mrlauer Says:

    😛 yourself 🙂

    In defense of django, it would be easy enough to write a few tags that do what those ruby helpers do; certainly including encapsulating all the javascript away. Very likely someone already has. Don’t know about an equally concise analog of respond_to, I don’t know what kind of magic actually goes on in there.

  3. Alex Says:

    respond_to simply selects which block of code to run based on the type of the response. The default action is to render the appropriate template based on the response type.

    The the page object is truly great, converting page update calls into javascript which is sent back over the connection and executed. Very slick.

    I’m sure it is possible to mimic all this in django, or anything else for that matter. However, it is built into rails, and built in extremely well. I am very surprised the django folks are not building similar functionality into the core framework. Not doing so seems like a good way to become obsolete.

  4. Some AJAX in Django « Michael Lauer’s Weblog Says:

    […] AJAX in Django Months ago I started looking into doing AJAXy things within Django, and (typically for me) never actually did any of them. […]

  5. tuximo Says:

    Thank you, for a time I’m searching by a tutorial about ajax and django.

Leave a reply to Some AJAX in Django « Michael Lauer’s Weblog Cancel reply