简体   繁体   中英

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.

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM