Django Unobtrusive Ajax

86 views
Skip to first unread message

Faraz Masood Khan

unread,
Sep 19, 2012, 11:02:43 AM9/19/12
to django...@googlegroups.com

Kurt Pruhs

unread,
Sep 19, 2012, 11:58:01 AM9/19/12
to django...@googlegroups.com
Great idea.
It looks like you have a legitimate method for "baking" AJAX into the Django framework. I will be starting a new Django project in October. I will try to integrate this.

Faraz Masood Khan

unread,
Sep 19, 2012, 12:20:55 PM9/19/12
to django...@googlegroups.com
Yes Kurt, you can vote for this feature over here:  https://code.djangoproject.com/ticket/18981 

Russell Keith-Magee

unread,
Sep 19, 2012, 7:08:56 PM9/19/12
to django...@googlegroups.com
… and, you can also see on that ticket that the chance of this getting
into Django itself is *very low*.

Django is, by design, a server side framework. AJAX is a primarily
client-side concern, with some light server-side data requirements.
There's absolutely no need for this to be tightly bound to Django's
core. If you want a more detailed explanation of why, I've spoken on
the topic at several conferences; most recently at PyCon AU:

http://www.youtube.com/watch?v=xFh40R5KcV8

Yours,
Russ Magee %-)
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/M3yxmpry5NEJ.
>
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

Kurt Pruhs

unread,
Sep 20, 2012, 1:10:26 PM9/20/12
to django...@googlegroups.com
@Russell
I understand what you are saying, as far as making AJAX a part of Django's core. It's a server-side framework. On the other hand, I was just in D.C. for DjangoCon and listened to Adrian Holovaty talk about making Django deliver real-time content. Did I misunderstand what he was saying? As far as I know, a JavaScript solution is the most viable for delivering real-time content to browsers. Is there another way to do this? Just curious what your thoughts are.

Kurt

Russell Keith-Magee

unread,
Sep 20, 2012, 8:12:03 PM9/20/12
to django...@googlegroups.com
On Fri, Sep 21, 2012 at 1:10 AM, Kurt Pruhs <kpr...@gmail.com> wrote:
> @Russell
> I understand what you are saying, as far as making AJAX a part of Django's
> core. It's a server-side framework. On the other hand, I was just in D.C.
> for DjangoCon and listened to Adrian Holovaty talk about making Django
> deliver real-time content. Did I misunderstand what he was saying? As far as
> I know, a JavaScript solution is the most viable for delivering real-time
> content to browsers. Is there another way to do this? Just curious what your
> thoughts are.

Put it this way - the question you need to answer is:

"Could I implement this externally, without making any changes to
Django's core?"

In the case of AJAX, the answer is definitely yes. You can write an
AJAX-compatible Django view entirely in user space. It requires no
modifications to Django itself. If someone wants to write a killer
AJAX library for Django, they should do so -- there's no reason it
needs to be baked into Django's core.

In the case of Real-time, the answer is maybe. Serving real-time data
will probably require some modifications to core -- the mechanisms
used to serve real-time data are different to traditional 'static
page' mechanisms. So yes, if we want to provide a solution for
real-time, it will probably mean making some changes to core. And,
since real-time data needs a front-end component, this may mean
including a front-end component.

That said, my overwhelming preference would be to follow up on Geoff
Schmidt's DjangoCon suggestion and concentrate on formalising a data
layer protocol for this sort of thing. This way, Django can maintain
it's server-side focus, and let those with a client-side focus
concentrate on their specialties. However, pragmatism may dictate that
this isn't possible - at least, not initially - because as Geoff
indicated, the protocol doesn't actually exist yet.

Yours,
Russ Magee %-)

Javier Guerra Giraldez

unread,
Sep 21, 2012, 10:36:08 AM9/21/12
to django...@googlegroups.com
On Thu, Sep 20, 2012 at 7:12 PM, Russell Keith-Magee
<rus...@keith-magee.com> wrote:
> In the case of Real-time, the answer is maybe. Serving real-time data
> will probably require some modifications to core -- the mechanisms
> used to serve real-time data are different to traditional 'static
> page' mechanisms.

I guess in this context by 'real-time' you mean something
not-exactly-http, like long polling, comet or websockets.

I agree that since plain AJAX is (from the point of view of the
server) just non-necesarily-html but totally http, the Django core
needs no modification, just some clever view handling.

--
Javier
Reply all
Reply to author
Forward
0 new messages