Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Dajaxproject.com

 Dajaxproject.com

Dajaxproject.com, 5m Lighting talk. Djangocon Europe, Amsterdam (Jun. 2011)

Jorge Bastida

May 09, 2011
Tweet

More Decks by Jorge Bastida

Other Decks in Technology

Transcript

  1. dajaxproject.com •  Set  of  easy  to  use  AJAX  libraries  for

     django. •  django-­‐dajaxice •  communica*on  core. •  send  data  to  your  browser  asynchronously. •  django-­‐dajax •  manipulate  the  DOM  using  python.
  2. @github Forks Watchers django-­‐dajax 6 110 django-­‐dajaxice 10 95 hKps://github.com/jorgebas*da/django-­‐dajax/

    hKps://github.com/jorgebas*da/django-­‐dajaxice/ It’s not enormous, but I’m really happy :)
  3. dajaxice  aims •  Uniform  communica*on  between  the  client  and  the

     server. •  JS  Framework  agnos:c. •  No  Prototype,  jQuery...  required. •  Presenta*on  logic  outside  the  views. •  No  presenta*on  code  inside  ajax  func*ons. •  Crossbrowsing  ready.
  4. Example from django.utils import simplejson from dajaxice.decorators import dajaxice_register @dajaxice_register

    def my_example(request): return simplejson.dumps({'message':'Hello World'})
  5. Example from django.utils import simplejson from dajaxice.decorators import dajaxice_register @dajaxice_register

    def my_example(request): return simplejson.dumps({'message':'Hello World'}) Yes. It’s a function that returns json
  6. Installa:on {% load dajaxice_templatetags %} <html> <head> <title>My base template</title>

    ... {% dajaxice_js_import %} </head> ... </html> automagically add the required js * *  It  could/should  be  served  sta*cally  for  produc*on.
  7. django-­‐dajax ✦  Manipulate  the  DOM  through  python. ✦  Nearly  0

     js  knowledge  required. ✦  Supports  some  JS  frameworks  like...
  8. django-­‐dajax ✦  Manipulate  the  DOM  through  python. ✦  Nearly  0

     js  knowledge  required. ✦  Supports  some  JS  frameworks  like... coupling boooo
  9. the  code from dajax.core.Dajax import Dajax def assign_test(request): dajax =

    Dajax() dajax.assign('#list li','innerHTML','Hello!') dajax.add_css_class('#list li','new') ... return dajax.json()
  10. the  code from dajax.core.Dajax import Dajax def assign_test(request): dajax =

    Dajax() dajax.assign('#list li','innerHTML','Hello!') dajax.add_css_class('#list li','new') ... return dajax.json() your actions