diff --git a/.travis.yml b/.travis.yml index fcc0e9a..ce1d61f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ env: - DJANGO=django==1.4.10 - DJANGO=django==1.5.5 - DJANGO=django==1.6.2 + - DJANGO=django==1.7 install: - pip install -q $DJANGO --use-mirrors @@ -27,5 +28,7 @@ matrix: - python: "2.6" env: DJANGO=django==1.5.5 - python: "2.6" - env: DJANGO=django==1.5.5 + env: DJANGO=django==1.6.2 + - python: "2.6" + env: DJANGO=django==1.7 diff --git a/README.rst b/README.rst index a5eb502..41fb417 100644 --- a/README.rst +++ b/README.rst @@ -23,7 +23,15 @@ From ``v0.6`` this project is not going to accept new features. In order to not Should I use django-dajaxice? ------------------------------ -In a word, No. I created this project 4 years ago as a cool tool in order to solve one specific problem I had at that time. These days using this project is a bad idea. Perhaps my vision of how my django projects should be coupled to libraries like this, or perhaps these days I really treasure the purity and simplicity of a vanilla django development. +In a word, No. I created this project 4 years ago as a cool tool in order to solve one specific problem I had at that time. + +These days using this project is a bad idea. + +Perhaps I'm more pragmatic now, perhaps my vision of how my django projects should be coupled to libraries like this has change, or perhaps these days I really treasure the purity and simplicity of a vanilla django development. + +If you want to mimic what this project does, you would only need some simple views and jQuery. + +Forget about adding more unnecessary complexity. Keep things simple. Project Aims diff --git a/dajaxice/__init__.py b/dajaxice/__init__.py index 675df2c..1f58bc6 100644 --- a/dajaxice/__init__.py +++ b/dajaxice/__init__.py @@ -1,2 +1 @@ -__version__ = (0, 6, 0, 0) -__version__string__ = '.'.join(map(str, __version__)) +__version__ = (0, 7, 'beta') diff --git a/dajaxice/tests/ajax.py b/dajaxice/tests/ajax.py index a98b42f..7d62d2e 100644 --- a/dajaxice/tests/ajax.py +++ b/dajaxice/tests/ajax.py @@ -1,5 +1,5 @@ -from dajaxice.decorators import dajaxice_register import json +from dajaxice.decorators import dajaxice_register @dajaxice_register diff --git a/dajaxice/views.py b/dajaxice/views.py index da2d326..e0a8a95 100644 --- a/dajaxice/views.py +++ b/dajaxice/views.py @@ -1,6 +1,6 @@ import sys import logging - +import django from django.conf import settings from django.views.generic.base import View from django.http import HttpResponse, Http404 @@ -57,9 +57,10 @@ def dispatch(self, request, name=None): if settings.DEBUG: raise response = dajaxice_config.DAJAXICE_EXCEPTION - - return HttpResponse( - response, content_type="application/json; charset=utf-8") + if django.get_version() >= '1.7': + return HttpResponse(response, content_type="application/x-json; charset=utf-8") + else: + return HttpResponse(response, mimetype="application/x-json; charset=utf-8") else: log.error('Function %s is not callable. method=%s', name, request.method) diff --git a/docs/changelog.rst b/docs/changelog.rst index c2d1015..d9576b7 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -12,6 +12,14 @@ Changelog * Enhanced debugging facilities. * A bunch of other enhancements. +0.7 +^^^^^ +* Make ``django-dajaxice`` work with ``django 1.7`` + +0.6 +^^^^^ +* Make ``django-dajaxice`` work with ``django 1.6`` + 0.5.5 ^^^^^ * Return XMLHttpRequest from concreate functions as well as from function call. diff --git a/docs/quickstart.rst b/docs/quickstart.rst index a18ba7c..1ec46bc 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -7,19 +7,19 @@ Create a file named ``ajax.py`` inside any of your apps. For example ``example/a Inside this file create a simple function that return json.:: - from django.utils import simplejson + import json def sayhello(request): - return simplejson.dumps({'message':'Hello World'}) + return json.dumps({'message':'Hello World'}) Now you'll need to register this function as a dajaxice function using the ``dajaxice_register`` decorator:: - from django.utils import simplejson + from django.utils import json from dajaxice.decorators import dajaxice_register @dajaxice_register def sayhello(request): - return simplejson.dumps({'message':'Hello World'}) + return json.dumps({'message':'Hello World'}) Invoque it from your JS ----------------------- @@ -46,12 +46,12 @@ How can I do a GET request instead of a POST one? When you register your functions as ajax functions, you can choose the http method using:: - from django.utils import simplejson + from django.utils import json from dajaxice.decorators import dajaxice_register @dajaxice_register(method='GET') def saybye(request): - return simplejson.dumps({'message':'Bye!'}) + return json.dumps({'message':'Bye!'}) This function will be executed doing a GET request and not a POST one. @@ -61,7 +61,7 @@ Can I combine both? Yes! You can register a function as many times as you want, for example:: - from django.utils import simplejson + from django.utils import json from dajaxice.decorators import dajaxice_register @dajaxice_register(method='POST', name='user.update')