Skip to content

Commit c0bbbd4

Browse files
authored
Update README.rst
1 parent 47c8c7b commit c0bbbd4

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

README.rst

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ or simply with:
6262
6363
2- Add ``'django_ajax'`` into the ``INSTALLED_APPS`` list.
6464

65-
3- Read usage section and enjoy its advantages!
65+
3- Read usage section and enjoy this feature!
6666

6767

6868
Usage
@@ -79,14 +79,14 @@ Usage
7979
def my_view(request):
8080
do_something()
8181
82-
When nothing is returned as result of view then returns (JSON format):
82+
When the view does not return anything, you will receive this response (JSON format):
8383

8484
.. code:: javascript
8585
8686
{"status": 200, "statusText": "OK", "content ": null}
8787
8888
89-
**Sending custom data in the response**
89+
**Sending content**
9090

9191
.. code:: python
9292
@@ -95,7 +95,7 @@ When nothing is returned as result of view then returns (JSON format):
9595
c = 2 + 3
9696
return {'result': c}
9797
98-
The result is send to the browser in the following way (JSON format)
98+
The whole result is converted into a JSON format as part of the `content' element:
9999

100100
.. code:: javascript
101101

@@ -115,7 +115,8 @@ The result is send to the browser in the following way (JSON format)
115115
# if the request.user is anonymous then this view not proceed
116116
return {'user_id': request.user.id}
117117

118-
The JSON response:
118+
The location or path of the redirection response will be given in the `content` item,
119+
also the `status` and `statusText` will reflect what is going on:
119120

120121
.. code:: javascript
121122
@@ -159,19 +160,17 @@ The JSON response:
159160
AJAXMiddleware
160161
~~~~~~~~~~~~~~
161162

162-
If you use AJAX quite frequently in your project, we suggest using the AJAXMiddleware described below.
163-
164-
Add ``django_ajax.middleware.AJAXMiddleware`` into the ``MIDDLEWARE_CLASSES`` list in ``settings.py``.
163+
If you are using AJAX at all times in your project, we suggest you activate the AJAXMiddleware described below.
165164

166-
All your responses will be converted to JSON if the request was made by AJAX, otherwise is return a HttpResponse.
165+
Add ``django_ajax.middleware.AJAXMiddleware`` to the ``MIDDLEWARE_CLASSES`` list in ``settings.py`` and all your responses will be converted to JSON whereas the request was made via AJAX, otherwise it will return a normal HttpResponse.
167166

168-
.. caution:: If you use this middleware cannot use ``@ajax`` decorator.
167+
.. caution:: If this middleware is activated you cannot use the ``@ajax`` decorator. That will cause double JSON conversion.
169168

170169

171170
AJAXMixin for class-based views
172171
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
173172

174-
``AJAXMixin`` is an object that calls the AJAX decorator.
173+
``AJAXMixin`` is an object that call to AJAX decorator.
175174

176175
.. code:: python
177176

0 commit comments

Comments
 (0)