Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 13 files changed
  • 0 comments
  • 1 contributor
5 README.md
Source Rendered
... ... @@ -1,6 +1,9 @@
1   -djangoajaxevent
  1 +Django Ajax Events
2 2 ===============
3 3
4 4 Request, respond, and react to ajax data in a more uniform way.
5 5
6 6 See original ReST: https://github.com/jacobstr/djangoajaxevent/blob/master/docs/index.rst for now.
  7 +
  8 +This project is a couple of years old now - it may no longer work with current
  9 +versions of Django. I'll verify that.
BIN  __init__.pyc
Binary file not shown
10 docs/index.rst
Source Rendered
@@ -10,7 +10,7 @@ Django Ajax Event
10 10 Goal
11 11 ====
12 12
13   - * To make it easier to make ajax **requests**, have Django **respond** with corresponding output, and **react** to this new data in your Javascript code.
  13 + * To make it easier to generate ajax **requests**, have Django **respond** with corresponding output, and **react** to this new data in your Javascript code.
14 14
15 15 ==============
16 16 How it Works
@@ -20,11 +20,11 @@ How it Works
20 20
21 21 jQuery is used for all the javascript code and `namespaced events <http://docs.jquery.com/Namespaced_Events>`_ are utilized.
22 22
23   -Django Ajax Event simplifies this process by formatting standard `AjaxResponses` (basically a wrapper around HttpResponse than guarantees JSON and formatting). On the client side, a piece of javascript code monitors incoming data for these
  23 +Django Ajax Event simplifies this process by formatting standard `AjaxResponses` (basically a wrapper around HttpResponse that guarantees JSON and formatting). On the client side, a piece of javascript code monitors incoming data for these
24 24 specially formatted responses and makes sure to trigger the appropriate events.
25 25
26 26 Events facilitate a decentralized approach: whether it's an update to comments, or a shopping cart, or message - an event will be triggered and you can update the bits and pieces of your interface that need to worry about this new information rather than
27   -writing a monolithic function that updates your shopping cart total, updates your shopping cart summary, flags products as 'being in your wishlist' all at the same time - each of these can be it's own widget, with it's own listener that listens for a `ItemAddedToCart` event.
  27 +writing a large function that updates your shopping cart total, updates your shopping cart summary, flags products as 'being in your wishlist' all at the same time - each of these can be it's own widget, with it's own listener that listens for a `ItemAddedToCart` event.
28 28
29 29 See :ref:`json-sample`.
30 30
@@ -84,9 +84,7 @@ Example Javascript Code
84 84 jQuery('#cart').find('#product_id-'+product_id).find('.qty').val(ajaxEvent.payload.newQty);
85 85 });
86 86
87   - // Because it's an event, should you add another widget to your page that also needs to reflect cart updates,
88   - // you can just create another event binding that listens for the same event as in the previous example,
89   - // but does it's own thang with the data.
  87 + // You can bind multiple events to teh same response.
90 88 jQuery(document).bind('CartUpdate.django',function(ajaxEvent){
91 89 // <div id="total_value">$<span class="value"></span></div>
92 90 // ajaxEvent.payload.value is an integer
BIN  models.pyc
Binary file not shown
BIN  templatetags/__init__.pyc
Binary file not shown
BIN  templatetags/draw_message.pyc
Binary file not shown
BIN  tests/__init__.pyc
Binary file not shown
BIN  tests/tests.pyc
Binary file not shown
BIN  tests/urls.pyc
Binary file not shown
BIN  tests/views.pyc
Binary file not shown
BIN  urls.pyc
Binary file not shown
BIN  utils.pyc
Binary file not shown
BIN  views.pyc
Binary file not shown

No commit comments for this range

Something went wrong with that request. Please try again.