Obviously, horses for courses, but what are some good ways to integrate javascript libraries with one\'s Django application?
I\'m planning on using jQuery, mostly becaus
On python side, I'd suggest to look at piston and tastypie.
(Starting with AJAX + Django myself, I also found Dajax, but went with piston
—felt more ‘unix-way’ for me, don't like these all-in-one solutions. Though piston wasn't updated for a long time now, so I'd recommend tastypie
, which is actively maintained.)
EDIT. There's also a similar project, django-rest-framework. Never used it myself yet, it's pretty new.
Basically, these libs help you create a fully working read-write API for your models, so you can perform create-read-update-delete operations from your javascript via HTTP. You don't need to define any views or serializers. Instead, you define resources, which is a decent abstraction, I think.
And it usually takes just a few lines of code, especially if your resources are tied to models.
However, if you need something more complicated, you can rethink your design write your views. With class-based views, it's pretty easy, too. Take a look at this snippet for example.