Hey folks --
Man, it's fun having such smart and passionate people on this list!
I've been thinking about how Django might leverage DHTML^H^H^H^H^H
AJAX a lot recently, and I think the framework I'll sketch out below
should make a bunch of people happy.
As I see it, there are three layers necessary for doing Django-AJAX:
The first layer will be a package -- django.core.serializers, most
likely -- which exports a set of serializer/unserializer libraries.
These libraries will know how to convert Django objects to and from a
specific format; we should most likely have XML and JSON serializers
at first crack, and XML-RPC and SOAP serializers could be quite useful.
The second layer will be a set of views not unlike the
django.views.generic, except that they'll take and produce data in
one of the formats defined by the serializer and be nicely RESTful
(appropriate use of HTTP verbs and such). So you'll be able to do
something like::
urlpatterns = patterns('',
('^rpc/', include('django.conf.urls.rpc')),
)
and get slick web services for free.
The third layer will be a toolkit that abstracts those views into
Javascript. I'm afraid that picking a Javascript framework is going
to turn into a bikeshed argument, but as long as whatever we choose
can seemlessly hook into the CRUD views, we should be OK. The idea
is that in Javascript I should be able to do::
entries = rpc.get_list('blogs.entries', {'limit' : 15})
(or something) and have it Just Workâ˘.
As I see it, these three bits should be written in a way that's
consistent with the rest of Django's philosophy: it should be very
easy to use all four together, but they should be loosely coupled so
that any layer could be used without the others. That way if you
don't like the JavaScript wrappers, you can always write your own.
Or, if you don't like the way Django does CRUD, you could roll your
own CRUD layer.
How does this sound to everyone?
Jacob