Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django Dajax vs Dajaxice

This may be a very silly question but I'm looking at implementing ajax in my django project and the big plugin seems to be dajax/dajaxice however I can't for the life of me distinguish between the two. Could someone clear this up a little for me? Thanks.

like image 755
apardes Avatar asked Oct 20 '13 14:10

apardes


2 Answers

ATTENTION:

Should I use django-dajax or django-dajaxice?

In a word, No. I created these projects 4 years ago as a cool tool in order to solve one specific problems I had at that time.

These days using these projects is a bad idea.

https://github.com/jorgebastida/django-dajax

like image 138
Trix Avatar answered Oct 16 '22 08:10

Trix


Dajaxice is the core of the project, to quote the website:

'Its main goal is to trivialize the asynchronous communication between the django server side code and your js code.'

This means that a django / python method on the server like:

from django.utils import simplejson
from dajaxice.decorators import dajaxice_register

@dajaxice_register
def multiply(request, a, b):
  result = int(a) * int(b)
  return simplejson.dumps({'result' : result})

Can be called on the client using javascript:

var result = Dajaxice.calcualator.multiply(1, 2);
console.log("Dajax says 1 * 2 = "+result);

Dajax provides a series of tools that incorporate dajaxice but requires less Javascript to be used, instead relying on more Python. The multiple example is here.

I have used dajaxice on a few projects without using dajax. Also worth mentioning is Tasty Pie this creates a similar interface on the server, and using JQuery ajax helper functions like .post(), client side, little additional code is required in javascript compared to dajaxice.

like image 22
Henry Florence Avatar answered Oct 16 '22 07:10

Henry Florence