Does Djange support Ajax to the same extent as TurboGears?

0 views
Skip to first unread message

walterbyrd

unread,
Nov 19, 2006, 1:27:22 PM11/19/06
to Django users
TurboGears seems to "advertise" their support of Ajax more than Django
does. I don't know if TurboGears has any features that make it more
Ajax friendly.

Adrian Holovaty

unread,
Nov 20, 2006, 11:37:02 AM11/20/06
to django...@googlegroups.com

My suggestion would be to build a quick application with both
frameworks and use the one that feels more natural to you. Both
frameworks will let you get the job done, but they have different
philosophies. TurboGears' philosophy is closer to that of Linux,
valuing the interoperability of obscure parts at almost a
religious/political level, with predictable results in terms of
usability and elegance. Django's philosophy is closer to that of a
Mac, which values usability, productivity and a great user experience
while allowing for a fair amount of flexibility under the hood.

At the end of the day, it's a personal decision. Good luck!

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com

Jeremy Dunck

unread,
Nov 20, 2006, 11:43:49 AM11/20/06
to django...@googlegroups.com
On 11/19/06, walterbyrd <walte...@iname.com> wrote:
>

TurboGears does provide more features in relation to ajax. These
features trade coupling for convenience. Where it works, this is
useful, but it's not a trade-off Django is making.

Eric Walstad

unread,
Nov 20, 2006, 11:57:23 AM11/20/06
to django...@googlegroups.com

/me runs, screaming something about GTFW, from the mailing list. ;)

James Bennett

unread,
Nov 20, 2006, 1:25:23 PM11/20/06
to django...@googlegroups.com
On 11/19/06, walterbyrd <walte...@iname.com> wrote:

It depends on your definition of "AJAX support" :)

If you mean "the framework writes your JavaScript for you", then no,
Django doesn't.

If you mean "the framework makes it easy to read XMLHttpRequests and
respond with XML or JSON", then yes, Django does.


--
"May the forces of evil become confused on the way to your house."
-- George Carlin

igor Guerrero

unread,
Nov 20, 2006, 2:36:08 PM11/20/06
to django...@googlegroups.com
I think that Django do the correct thing, when designers want some Ajax they should do it in JavaScript... remember the majority of designers are not programmers and not Python programmers, they want a template system that is not complicated. Personally I agree with Jacob: "I don't like the template system because it is not for me"

And the comparison between Linux and Mac... heee let's not talk about it because it can be
a War!!!! :P, for me Linux is like Django simply they are Best

Jeremy Dunck

unread,
Nov 20, 2006, 2:38:03 PM11/20/06
to django...@googlegroups.com
On 11/20/06, James Bennett <ubern...@gmail.com> wrote:
>
> If you mean "the framework makes it easy to read XMLHttpRequests and
> respond with XML or JSON", then yes, Django does.


def ajaxy_data(request, south, west, north, east):
....
return HttpResponse("handleData(" + simplejson.dumps(ret) + ");")

Mmm. That's nice Ajax support. ;-)

gabor

unread,
Nov 20, 2006, 3:17:17 PM11/20/06
to django...@googlegroups.com
Jeremy Dunck wrote:
> On 11/19/06, walterbyrd <walte...@iname.com> wrote:
>> TurboGears seems to "advertise" their support of Ajax more than Django
>> does. I don't know if TurboGears has any features that make it more
>> Ajax friendly.
>>
>
> TurboGears does provide more features in relation to ajax.

(wow, finally someone with info :)

hi,

please, please, pretty please tell me/us, what ajax-features does
Turbogears have?

gabor

Jeremy Dunck

unread,
Nov 20, 2006, 4:25:50 PM11/20/06
to django...@googlegroups.com
On 11/20/06, gabor <ga...@nekomancer.net> wrote:
>
> (wow, finally someone with info :)
>
> hi,
>
> please, please, pretty please tell me/us, what ajax-features does
> Turbogears have?

See, for example,
http://docs.turbogears.org/1.0/JSON

Waylan Limberg

unread,
Nov 20, 2006, 4:53:29 PM11/20/06
to django...@googlegroups.com

Then see: http://www.djangoproject.com/documentation/serialization/

I realize it's currently still under development and therefore doesn't
have a direct link from the doc page, but it is there and works.

>
> >
>


--
----
Waylan Limberg
way...@gmail.com

Kenneth Gonsalves

unread,
Nov 20, 2006, 9:44:51 PM11/20/06
to django...@googlegroups.com

On 20-Nov-06, at 10:07 PM, Adrian Holovaty wrote:

> ill let you get the job done, but they have different
> philosophies. TurboGears' philosophy is closer to that of Linux,
> valuing the interoperability of obscure parts at almost a
> religious/political level, with predictable results in terms of
> usability and elegance. Django's philosophy is closer to that of a
> Mac, which values usability, productivity and a great user experience
> while allowing for a fair amount of flexibility under the hood.

i wish you hadnt said this. Are you talking about the linux kernel
development model or about linux distributions? As far as i can see,
django follows the bazaar model of development, also followed by the
linux kernel development. It also seems to me that django is
following the route of small incremental development rather than a
grand master-planned strategy. No one but apple knows what model the
mac follows. I could agree with you if you had said:
linux:bsd = turbogears:django. But this is not the crucial
difference. Django is born of the sell it, free it model, proven in
production as response to a real need, whereas turbo-gears is born of
scratching and itch, hence more of a hobbyist tool. This is the real
difference. An interesting statistic - about a year back,
#rubyonrails had 400 members, #django and #turbogears had around 45
each. Today #django averages around 160 whereas the other two are at
the same number.

--

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/


comechao

unread,
Nov 21, 2006, 9:27:38 AM11/21/06
to Django users
And if suport json, its ajax friendly. So we can chose a ajax framework
( i'm YUI and jQuery happy user :D ).

gabor

unread,
Nov 21, 2006, 10:36:10 AM11/21/06
to django...@googlegroups.com

and please note, that (if i'm reading it correctly) it's something
different.

the django-serialization serializes a django-object.

the turbogears-json (at least the one linked from this mail) simply
json-serializes a dictionary. that's MUCH simpler.

in django you would probably do:

> from django.utils.simplejson import dumps
>
> def myview(request):
> res = {'a':2,'b':3}
> return HttpResponse(dumps(res),mimetype='application/json')

or, we can even write a decorator, like:

> def json_wrap(func):
> def _json_wrap(*args, **kwargs):
> return HttpResponse(dumps(func(*args,**kwargs)),mimetype="application/json")
> return _json_wrap

and then you can use it like:

> @json_wrap
> def foo(request,a,b,c):
> return dict(a=a,b=b,c=c)

p.s: there might be errors in the source code ,but the idea should work

gabor

James Bennett

unread,
Nov 21, 2006, 10:45:30 AM11/21/06
to django...@googlegroups.com
On 11/21/06, gabor <ga...@nekomancer.net> wrote:
> and please note, that (if i'm reading it correctly) it's something
> different.
>
> the django-serialization serializes a django-object.
>
> the turbogears-json (at least the one linked from this mail) simply
> json-serializes a dictionary. that's MUCH simpler.

Yes and no.

The JSON serializer is meant for serializing Django model instances,
because there are some particular quirks which need to be handled
correctly. So if you have a QuerySet or a list of model instances, the
serializer is the way to go. For any other type of data, plain old
'simplejson.dumps()' will work fine, and simplejson is bundled in
Django (at django.util.simplejson).

gabor

unread,
Nov 21, 2006, 10:54:04 AM11/21/06
to django...@googlegroups.com
James Bennett wrote:
> On 11/21/06, gabor <ga...@nekomancer.net> wrote:
>> and please note, that (if i'm reading it correctly) it's something
>> different.
>>
>> the django-serialization serializes a django-object.
>>
>> the turbogears-json (at least the one linked from this mail) simply
>> json-serializes a dictionary. that's MUCH simpler.
>
> Yes and no.
>
> The JSON serializer is meant for serializing Django model instances,
> because there are some particular quirks which need to be handled
> correctly. So if you have a QuerySet or a list of model instances, the
> serializer is the way to go. For any other type of data, plain old
> 'simplejson.dumps()' will work fine, and simplejson is bundled in
> Django (at django.util.simplejson).
>

i'm sorry, but which part of my mail is referred by the "no" ? :)

gabor

James Bennett

unread,
Nov 21, 2006, 11:41:12 AM11/21/06
to django...@googlegroups.com
On 11/21/06, gabor <ga...@nekomancer.net> wrote:
> i'm sorry, but which part of my mail is referred by the "no" ? :)

'Yes' in that the TurboGears stuff works on any dictionary and the
Django serializer class only works on lists of model instances. 'No'
in that we bundle simplejson so you have a way to dump any Python
value to JSON :)

Reply all
Reply to author
Forward
0 new messages