├── .gitignore ├── AUTHORS ├── COPYING ├── MANIFEST.in ├── README.rst ├── dajax ├── __init__.py ├── core.py ├── models.py └── static │ └── dajax │ ├── dojo.dajax.core.js │ ├── jquery.dajax.core.js │ ├── mootools.dajax.core.js │ └── prototype.dajax.core.js ├── docs ├── Makefile ├── api.rst ├── changelog.rst ├── conf.py ├── img │ └── overview.png ├── index.rst ├── installation.rst ├── make.bat └── migrating-to-09.rst └── setup.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.egg-info 3 | dist 4 | build 5 | .DS_Store 6 | docs/_build 7 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Glue is mainly developed and maintained by Jorge Bastida 2 | 3 | A big thanks to all the contributors: 4 | Angel Abad for the Debian and Ubuntu distribution package. 5 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2012 Benito Jorge Bastida 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above 12 | copyright notice, this list of conditions and the following 13 | disclaimer in the documentation and/or other materials provided 14 | with the distribution. 15 | 16 | 3. Neither the name of the author nor the names of other 17 | contributors may be used to endorse or promote products derived 18 | from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include *.py 2 | include COPYING 3 | include AUTHORS 4 | recursive-include dajax * 5 | recursive-exclude dajax *.pyc 6 | recursive-include docs * 7 | prune docs/_build 8 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | django-dajax 2 | ============ 3 | 4 | Dajax is a powerfull tool to easily and super-fastly develop asynchronous presentation logic in web applications using python and almost no lines of JS source code. 5 | 6 | It supports up to four of the most popular JS frameworks: 7 | 8 | * jQuery 9 | * Prototype 10 | * Dojo 11 | * mootols 12 | 13 | Using ``django-dajaxice`` communication core, ``django-dajax`` implements an abstraction layer between the presentation logic managed with JS and your python business logic. With dajax you can modify your ``DOM`` structure directly from python. 14 | 15 | For more information about how django-dajax works: https://dajaxproject.com 16 | 17 | Official site http://dajaxproject.com 18 | Documentation http://readthedocs.org/projects/django-dajax/ 19 | 20 | Project status 21 | ---------------- 22 | From ``v0.9.2`` this project is not going to accept new features. In order to not break existing projects using this library, ``django-dajax`` and ``django-dajaxice`` will be maintained until ``django 1.8`` is released. 23 | 24 | 25 | Should I use django-dajax or django-dajaxice? 26 | --------------------------------------------- 27 | 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. 28 | 29 | These days using these projects is a bad idea. 30 | 31 | Perhaps I'm more pragmatic now, perhaps my vision of how my django projects should be coupled to libraries like these has change, or perhaps these days I really treasure the purity and simplicity of a vanilla django development. 32 | 33 | If you want to use this project, you are probably wrong. You should stop couplig your interface with your backend or... in the long term it will explode in your face. 34 | 35 | Forget about adding more unnecessary complexity. Keep things simple. 36 | -------------------------------------------------------------------------------- /dajax/__init__.py: -------------------------------------------------------------------------------- 1 | __version__ = (0, 9, 2, 'beta') 2 | -------------------------------------------------------------------------------- /dajax/core.py: -------------------------------------------------------------------------------- 1 | from django.utils import simplejson as json 2 | 3 | 4 | class Dajax(object): 5 | 6 | def __init__(self): 7 | self.calls = [] 8 | 9 | def json(self): 10 | return json.dumps(self.calls) 11 | 12 | def alert(self, message): 13 | self.calls.append({'cmd': 'alert', 'val': message}) 14 | 15 | def assign(self, id, attribute, value): 16 | self.calls.append({'cmd': 'as', 'id': id, 'prop': attribute, 'val': value}) 17 | 18 | def add_css_class(self, id, value): 19 | if not hasattr(value, '__iter__'): 20 | value = [value] 21 | self.calls.append({'cmd': 'addcc', 'id': id, 'val': value}) 22 | 23 | def remove_css_class(self, id, value): 24 | if not hasattr(value, '__iter__'): 25 | value = [value] 26 | self.calls.append({'cmd': 'remcc', 'id': id, 'val': value}) 27 | 28 | def append(self, id, attribute, value): 29 | self.calls.append({'cmd': 'ap', 'id': id, 'prop': attribute, 'val': value}) 30 | 31 | def prepend(self, id, attribute, value): 32 | self.calls.append({'cmd': 'pp', 'id': id, 'prop': attribute, 'val': value}) 33 | 34 | def clear(self, id, attribute): 35 | self.calls.append({'cmd': 'clr', 'id': id, 'prop': attribute}) 36 | 37 | def redirect(self, url, delay=0): 38 | self.calls.append({'cmd': 'red', 'url': url, 'delay': delay}) 39 | 40 | def script(self, code): # OK 41 | self.calls.append({'cmd': 'js', 'val': code}) 42 | 43 | def remove(self, id): 44 | self.calls.append({'cmd': 'rm', 'id': id}) 45 | 46 | def add_data(self, data, function): 47 | self.calls.append({'cmd': 'data', 'val': data, 'fun': function}) 48 | -------------------------------------------------------------------------------- /dajax/models.py: -------------------------------------------------------------------------------- 1 | # Don't delete me 2 | -------------------------------------------------------------------------------- /dajax/static/dajax/dojo.dajax.core.js: -------------------------------------------------------------------------------- 1 | var Dajax = { 2 | process: function(data) 3 | { 4 | dojo.forEach(data, function(elem,i){ 5 | switch(elem.cmd) 6 | { 7 | case 'alert': 8 | alert(elem.val); 9 | break; 10 | 11 | case 'data': 12 | eval( elem.fun+"(elem.val);" ); 13 | break; 14 | 15 | case 'as': 16 | if(elem.prop === 'innerHTML'){ 17 | dojo.forEach(dojo.query(elem.id), function(e){ 18 | require(["dojo/html"], function(html){ 19 | html.set(e, elem.val); 20 | }); 21 | }); 22 | } 23 | else{ 24 | dojo.forEach(dojo.query(elem.id),function(e){ e[elem.prop] = elem.val; }); 25 | } 26 | break; 27 | 28 | case 'addcc': 29 | dojo.forEach(elem.val,function(e){ 30 | dojo.query(elem.id).addClass(e); 31 | }); 32 | break; 33 | 34 | case 'remcc': 35 | dojo.forEach(elem.val,function(e){ 36 | dojo.query(elem.id).removeClass(e); 37 | }); 38 | break; 39 | 40 | case 'ap': 41 | dojo.forEach(dojo.query(elem.id),function(e){ e[elem.prop] += elem.val;}); 42 | break; 43 | 44 | case 'pp': 45 | dojo.forEach(dojo.query(elem.id),function(e){ e[elem.prop] = elem.val + e[elem.prop] ;}); 46 | break; 47 | 48 | case 'clr': 49 | dojo.forEach(dojo.query(elem.id),function(e){ e[elem.prop] = ""; }); 50 | break; 51 | 52 | case 'red': 53 | window.setTimeout('window.location="'+elem.url+'";',elem.delay); 54 | break; 55 | 56 | case 'js': 57 | eval(elem.val); 58 | break; 59 | 60 | case 'rm': 61 | dojo.forEach(dojo.query(elem.id), "dojo.query(item).orphan();"); 62 | break; 63 | 64 | default: 65 | break; 66 | } 67 | }); 68 | } 69 | }; 70 | -------------------------------------------------------------------------------- /dajax/static/dajax/jquery.dajax.core.js: -------------------------------------------------------------------------------- 1 | var Dajax = { 2 | process: function(data) 3 | { 4 | $.each(data, function(i,elem){ 5 | switch(elem.cmd) 6 | { 7 | case 'alert': 8 | alert(elem.val); 9 | break; 10 | 11 | case 'data': 12 | eval( elem.fun+"(elem.val);" ); 13 | break; 14 | 15 | case 'as': 16 | if(elem.prop == 'innerHTML'){ 17 | $(elem.id).html(elem.val); 18 | } 19 | else{ 20 | jQuery.each($(elem.id),function(){ this[elem.prop] = elem.val; }); 21 | } 22 | break; 23 | 24 | case 'addcc': 25 | jQuery.each(elem.val,function(){ 26 | $(elem.id).addClass(String(this)); 27 | }); 28 | break; 29 | 30 | case 'remcc': 31 | jQuery.each(elem.val,function(){ 32 | $(elem.id).removeClass(String(this)); 33 | }); 34 | break; 35 | 36 | case 'ap': 37 | jQuery.each($(elem.id),function(){ this[elem.prop] += elem.val; }); 38 | break; 39 | 40 | case 'pp': 41 | jQuery.each($(elem.id),function(){ this[elem.prop] = elem.val + this[elem.prop]; }); 42 | break; 43 | 44 | case 'clr': 45 | jQuery.each($(elem.id),function(){ this[elem.prop] = ""; }); 46 | break; 47 | 48 | case 'red': 49 | window.setTimeout('window.location="'+elem.url+'";',elem.delay); 50 | break; 51 | 52 | case 'js': 53 | eval(elem.val); 54 | break; 55 | 56 | case 'rm': 57 | $(elem.id).remove(); 58 | break; 59 | 60 | default: 61 | break; 62 | } 63 | }); 64 | } 65 | }; 66 | -------------------------------------------------------------------------------- /dajax/static/dajax/mootools.dajax.core.js: -------------------------------------------------------------------------------- 1 | var Dajax = { 2 | process: function(data) 3 | { 4 | data.each(function(elem){ 5 | switch(elem.cmd) 6 | { 7 | case 'alert': 8 | alert(elem.val); 9 | break; 10 | 11 | case 'data': 12 | eval( elem.fun+"(elem.val);" ); 13 | break; 14 | 15 | case 'as': 16 | if(elem.prop === 'innerHTML'){ 17 | $$(elem.id).each(function(e){ e.set('html', elem.val); }); 18 | } 19 | else{ 20 | $$(elem.id).each(function(e){ e[elem.prop] = elem.val; }); 21 | } 22 | break; 23 | 24 | case 'addcc': 25 | elem.val.each(function(cssclass){ 26 | $$(elem.id).each(function(e){ e.addClass(cssclass);}); 27 | }); 28 | break; 29 | 30 | case 'remcc': 31 | elem.val.each(function(cssclass){ 32 | $$(elem.id).each(function(e){ e.removeClass(cssclass);}); 33 | }); 34 | break; 35 | 36 | case 'ap': 37 | $$(elem.id).each(function(e){ e[elem.prop] += elem.val; }); 38 | break; 39 | 40 | case 'pp': 41 | $$(elem.id).each(function(e){ e[elem.prop] = elem.val + e[elem.prop]; }); 42 | break; 43 | 44 | case 'clr': 45 | $$(elem.id).each(function(e){ e[elem.prop]=""; }); 46 | break; 47 | 48 | case 'red': 49 | window.setTimeout('window.location="'+elem.url+'";',elem.delay); 50 | break; 51 | 52 | case 'js': 53 | eval(elem.val); 54 | break; 55 | 56 | case 'rm': 57 | $$(elem.id).each(function(e){ e.destroy(); }); 58 | break; 59 | 60 | default: 61 | break; 62 | } 63 | }); 64 | } 65 | }; 66 | -------------------------------------------------------------------------------- /dajax/static/dajax/prototype.dajax.core.js: -------------------------------------------------------------------------------- 1 | var Dajax = { 2 | process: function(data) 3 | { 4 | data.each(function(elem){ 5 | switch(elem.cmd) 6 | { 7 | case 'alert': 8 | alert(elem.val); 9 | break; 10 | 11 | case 'data': 12 | eval( elem.fun+"(elem.val);" ); 13 | break; 14 | 15 | case 'as': 16 | if(elem.prop === 'innerHTML'){ 17 | $$(elem.id).each(function(e){Element.update(e, elem.val);}); 18 | } 19 | else{ 20 | $$(elem.id).each(function(e){e[elem.prop] = elem.val;}); 21 | } 22 | break; 23 | 24 | case 'addcc': 25 | elem.val.each(function(cssclass){ 26 | $$(elem.id).each(function(e){ e.addClassName(cssclass);}); 27 | }); 28 | break; 29 | 30 | case 'remcc': 31 | elem.val.each(function(cssclass){ 32 | $$(elem.id).each(function(e){ e.removeClassName(cssclass);}); 33 | }); 34 | break; 35 | 36 | case 'ap': 37 | $$(elem.id).each(function(e){ e[elem.prop] += elem.val;}); 38 | break; 39 | 40 | case 'pp': 41 | $$(elem.id).each(function(e){ e[elem.prop] = elem.val + e[elem.prop];}); 42 | break; 43 | 44 | case 'clr': 45 | $$(elem.id).each(function(e){e[elem.prop] = "";}); 46 | break; 47 | 48 | case 'red': 49 | window.setTimeout('window.location="'+elem.url+'";',elem.delay); 50 | break; 51 | 52 | case 'js': 53 | eval(elem.val); 54 | break; 55 | 56 | case 'rm': 57 | $$(elem.id).each(function(e){e.remove();}); 58 | break; 59 | 60 | default: 61 | break; 62 | } 63 | }); 64 | } 65 | }; 66 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = _build 9 | 10 | # Internal variables. 11 | PAPEROPT_a4 = -D latex_paper_size=a4 12 | PAPEROPT_letter = -D latex_paper_size=letter 13 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 14 | 15 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest 16 | 17 | help: 18 | @echo "Please use \`make ' where is one of" 19 | @echo " html to make standalone HTML files" 20 | @echo " dirhtml to make HTML files named index.html in directories" 21 | @echo " singlehtml to make a single large HTML file" 22 | @echo " pickle to make pickle files" 23 | @echo " json to make JSON files" 24 | @echo " htmlhelp to make HTML files and a HTML help project" 25 | @echo " qthelp to make HTML files and a qthelp project" 26 | @echo " devhelp to make HTML files and a Devhelp project" 27 | @echo " epub to make an epub" 28 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 29 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 30 | @echo " text to make text files" 31 | @echo " man to make manual pages" 32 | @echo " changes to make an overview of all changed/added/deprecated items" 33 | @echo " linkcheck to check all external links for integrity" 34 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 35 | 36 | clean: 37 | -rm -rf $(BUILDDIR)/* 38 | 39 | html: 40 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 41 | @echo 42 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 43 | 44 | dirhtml: 45 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 46 | @echo 47 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 48 | 49 | singlehtml: 50 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 51 | @echo 52 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 53 | 54 | pickle: 55 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 56 | @echo 57 | @echo "Build finished; now you can process the pickle files." 58 | 59 | json: 60 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 61 | @echo 62 | @echo "Build finished; now you can process the JSON files." 63 | 64 | htmlhelp: 65 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 66 | @echo 67 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 68 | ".hhp project file in $(BUILDDIR)/htmlhelp." 69 | 70 | qthelp: 71 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 72 | @echo 73 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 74 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 75 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/django-dajax.qhcp" 76 | @echo "To view the help file:" 77 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/django-dajax.qhc" 78 | 79 | devhelp: 80 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 81 | @echo 82 | @echo "Build finished." 83 | @echo "To view the help file:" 84 | @echo "# mkdir -p $$HOME/.local/share/devhelp/django-dajax" 85 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/django-dajax" 86 | @echo "# devhelp" 87 | 88 | epub: 89 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 90 | @echo 91 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 92 | 93 | latex: 94 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 95 | @echo 96 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 97 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 98 | "(use \`make latexpdf' here to do that automatically)." 99 | 100 | latexpdf: 101 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 102 | @echo "Running LaTeX files through pdflatex..." 103 | make -C $(BUILDDIR)/latex all-pdf 104 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 105 | 106 | text: 107 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 108 | @echo 109 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 110 | 111 | man: 112 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 113 | @echo 114 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 115 | 116 | changes: 117 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 118 | @echo 119 | @echo "The overview file is in $(BUILDDIR)/changes." 120 | 121 | linkcheck: 122 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 123 | @echo 124 | @echo "Link check complete; look for any errors in the above output " \ 125 | "or in $(BUILDDIR)/linkcheck/output.txt." 126 | 127 | doctest: 128 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 129 | @echo "Testing of doctests in the sources finished, look at the " \ 130 | "results in $(BUILDDIR)/doctest/output.txt." 131 | -------------------------------------------------------------------------------- /docs/api.rst: -------------------------------------------------------------------------------- 1 | API 2 | === 3 | 4 | alert(message) 5 | -------------- 6 | Alert a ``message``. 7 | 8 | * **message**: Any message you want to alert 9 | 10 | Usage Example:: 11 | 12 | from dajax.core import Dajax 13 | 14 | def alert_example(request): 15 | dajax = Dajax() 16 | dajax.alert('Hello from python!') 17 | return dajax.json() 18 | 19 | assign(selector, attribute, value) 20 | ---------------------------------- 21 | Assign to all elements that matches with the ``selector`` as `attribute`` the ``value``. 22 | 23 | 24 | * **selector**: CSS selector. 25 | * **attribute**: Any valid attribute. 26 | * **value**: The value you want to assing. 27 | 28 | Usage Example:: 29 | 30 | from dajax.core import Dajax 31 | 32 | def assign_example(request): 33 | dajax = Dajax() 34 | dajax.assign('#button', 'value', 'Click here!') 35 | dajax.assign('div .alert', 'innerHTML', 'This email is invalid') 36 | return dajax.json() 37 | 38 | 39 | add_css_class(selector, value) 40 | ------------------------------ 41 | Assign to all elements that matches with the ``selector`` the ``CSS`` class ``value``. ``value`` could be a string or a list of them. 42 | 43 | * **selector**: CSS selector. 44 | * **value**: Any CSS class name or a list of them. 45 | 46 | 47 | Usage Example:: 48 | 49 | from dajax.core import Dajax 50 | 51 | def add_css_example(request): 52 | dajax = Dajax() 53 | dajax.add_css_class('div .alert', 'red') 54 | dajax.add_css_class('div .warning', ['big', 'yellow']) 55 | return dajax.json() 56 | 57 | 58 | remove_css_class(selector, value) 59 | --------------------------------- 60 | Remove to all elements that matches with the ``selector`` the ``CSS`` class ``value``. ``value`` could be a string or a list of them. 61 | 62 | * **selector**: CSS selector. 63 | * **value**: Any CSS class name or a list of them. 64 | 65 | 66 | Usage Example:: 67 | 68 | from dajax.core import Dajax 69 | 70 | def remove_css_example(request): 71 | dajax = Dajax() 72 | dajax.remove_css_class('div .message', 'big-message') 73 | dajax.remove_css_class('div .total', ['big', 'red']) 74 | return dajax.json() 75 | 76 | append(selector, attribute, value) 77 | ---------------------------------- 78 | 79 | Append to all elements that matches with the ``selector`` ``value`` to with the desired ``attribute``. 80 | 81 | * **selector**: CSS selector. 82 | * **attribute**: Any valid attribute. 83 | * **value**: Any CSS class name or a list of them. 84 | 85 | Usage Example:: 86 | 87 | from dajax.core import Dajax 88 | 89 | def append_example(request): 90 | dajax = Dajax() 91 | dajax.append('#message', 'innerHTML', 'Last message') 92 | return dajax.json() 93 | 94 | 95 | prepend(selector, attribute, value) 96 | ----------------------------------- 97 | 98 | Prepend to all elements that matches with the ``selector`` ``value`` to with the desired ``attribute``. 99 | 100 | * **selector**: CSS selector. 101 | * **attribute**: Any valid attribute. 102 | * **value**: Any CSS class name or a list of them. 103 | 104 | Usage Example:: 105 | 106 | from dajax.core import Dajax 107 | 108 | def prepend_example(request): 109 | dajax = Dajax() 110 | dajax.prepend('#message', 'innerHTML', 'First message') 111 | return dajax.json() 112 | 113 | 114 | clear(selector, attribute) 115 | -------------------------- 116 | 117 | Clear all elements that matches with the ``selector`` the desired ``attribute``. 118 | 119 | * **selector**: CSS selector. 120 | * **attribute**: Any valid attribute. 121 | 122 | Usage Example:: 123 | 124 | from dajax.core import Dajax 125 | 126 | def clear_example(request): 127 | dajax = Dajax() 128 | dajax.clear('#message', 'innerHTML') 129 | return dajax.json() 130 | 131 | 132 | redirect(url, delay=0) 133 | ---------------------- 134 | 135 | Redirect current page to ``url`` with a delay of ``ms``. 136 | 137 | * **url**: Destination URL. 138 | * **delay**: Number of ms that the browser should wait before redirecting. 139 | 140 | Usage Example:: 141 | 142 | from dajax.core import Dajax 143 | 144 | def redirect_example(request): 145 | dajax = Dajax() 146 | dajax.redirect('http://google.com', delay=2000) 147 | return dajax.json() 148 | 149 | 150 | script(code) 151 | ------------ 152 | 153 | Executes ``code`` in the browser 154 | 155 | * **code**: Code to execute. 156 | 157 | Usage Example:: 158 | 159 | from dajax.core import Dajax 160 | 161 | def code_example(request): 162 | dajax = Dajax() 163 | dajax.code('my_function();') 164 | return dajax.json() 165 | 166 | 167 | remove(selector) 168 | ---------------- 169 | 170 | Remove all elements that matches ``selector``. 171 | 172 | * **selector**: CSS selector. 173 | 174 | Usage Example:: 175 | 176 | from dajax.core import Dajax 177 | 178 | def code_example(request): 179 | dajax = Dajax() 180 | dajax.remove('.message') 181 | return dajax.json() 182 | 183 | 184 | add_data(data, callback_function) 185 | --------------------------------- 186 | 187 | Send ``data`` to the browser and call ``callback_function`` using this ``data``. 188 | 189 | * **data**: Data you want to send to your function. 190 | * **callback_function**: Fuction you want to call in the browser. 191 | 192 | Usage Example:: 193 | 194 | from dajax.core import Dajax 195 | 196 | def data_example(request): 197 | dajax = Dajax() 198 | dajax.add_data(range(10), 'my_js_function') 199 | return dajax.json() 200 | -------------------------------------------------------------------------------- /docs/changelog.rst: -------------------------------------------------------------------------------- 1 | Changelog 2 | ========= 3 | 4 | 0.9.2 5 | ^^^^ 6 | * Fix unicode issues 7 | * Fix Internet Explorer issues modifying element's innerHTML 8 | 9 | 0.9 10 | ^^^ 11 | * Move dajaxice core from dajaxice.core.Dajax to dajax.core 12 | * Django 1.3 is now a requirement 13 | * dajaxice 0.5 is now a requirement 14 | * Static files are now located inside static instead of src 15 | 16 | 0.8.4 17 | ^^^^^ 18 | * Upgrade to dajaxice 0.1.3 (New Dajaxice.EXCEPTION) 19 | * Dajax PEP8 naming style for addCSSClass and removeCSSClass 20 | * Fixed some bugs in examples 21 | * Fixed unicode problems 22 | 23 | 0.8.3 24 | ^^^^^ 25 | * General: New and cleaned setup.py 26 | 27 | 0.8.2 28 | ^^^^^ 29 | * General: Upgrade to dajaxice 0.1.1 30 | 31 | 0.8.0.1 32 | ^^^^^^^ 33 | * dajaxice released, now dajax use it as communication core 34 | * cleaned all the code 35 | 36 | 0.7.5 37 | ^^^^^ 38 | * Added Dojo support 39 | * Cleaned js files 40 | * Ajax functions outside project folder now supported. 41 | * Flickr in place editor example. 42 | 43 | 0.7.4.1 44 | ^^^^^^^ 45 | * Typo error importing ajax functions 46 | 47 | 0.7.4.0 48 | ^^^^^^^ 49 | * Typo error importing ajax functions 50 | * Examples: Form validation using new utf-8 support. 51 | * Examples: New deserialize method 52 | * Examples: New DAJAX_CACHE_CONTROL usage in dajax.core.js view. 53 | -------------------------------------------------------------------------------- /docs/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # django-dajax documentation build configuration file, created by 4 | # sphinx-quickstart on Sat Jul 14 08:42:53 2012. 5 | # 6 | # This file is execfile()d with the current directory set to its containing dir. 7 | # 8 | # Note that not all possible configuration values are present in this 9 | # autogenerated file. 10 | # 11 | # All configuration values have a default; values that are commented out 12 | # serve to show the default. 13 | 14 | import sys, os 15 | 16 | # If extensions (or modules to document with autodoc) are in another directory, 17 | # add these directories to sys.path here. If the directory is relative to the 18 | # documentation root, use os.path.abspath to make it absolute, like shown here. 19 | #sys.path.insert(0, os.path.abspath('.')) 20 | 21 | # -- General configuration ----------------------------------------------------- 22 | 23 | # If your documentation needs a minimal Sphinx version, state it here. 24 | #needs_sphinx = '1.0' 25 | 26 | # Add any Sphinx extension module names here, as strings. They can be extensions 27 | # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 28 | extensions = [] 29 | 30 | # Add any paths that contain templates here, relative to this directory. 31 | templates_path = ['_templates'] 32 | 33 | # The suffix of source filenames. 34 | source_suffix = '.rst' 35 | 36 | # The encoding of source files. 37 | #source_encoding = 'utf-8-sig' 38 | 39 | # The master toctree document. 40 | master_doc = 'index' 41 | 42 | # General information about the project. 43 | project = u'django-dajax' 44 | copyright = u'2012, Jorge Bastida' 45 | 46 | # The version info for the project you're documenting, acts as replacement for 47 | # |version| and |release|, also used in various other places throughout the 48 | # built documents. 49 | # 50 | 51 | version = '0.9' 52 | release = '0.9' 53 | # The language for content autogenerated by Sphinx. Refer to documentation 54 | # for a list of supported languages. 55 | #language = None 56 | 57 | # There are two options for replacing |today|: either, you set today to some 58 | # non-false value, then it is used: 59 | #today = '' 60 | # Else, today_fmt is used as the format for a strftime call. 61 | #today_fmt = '%B %d, %Y' 62 | 63 | # List of patterns, relative to source directory, that match files and 64 | # directories to ignore when looking for source files. 65 | exclude_patterns = ['_build'] 66 | 67 | # The reST default role (used for this markup: `text`) to use for all documents. 68 | #default_role = None 69 | 70 | # If true, '()' will be appended to :func: etc. cross-reference text. 71 | #add_function_parentheses = True 72 | 73 | # If true, the current module name will be prepended to all description 74 | # unit titles (such as .. function::). 75 | #add_module_names = True 76 | 77 | # If true, sectionauthor and moduleauthor directives will be shown in the 78 | # output. They are ignored by default. 79 | #show_authors = False 80 | 81 | # The name of the Pygments (syntax highlighting) style to use. 82 | pygments_style = 'sphinx' 83 | 84 | # A list of ignored prefixes for module index sorting. 85 | #modindex_common_prefix = [] 86 | 87 | 88 | # -- Options for HTML output --------------------------------------------------- 89 | 90 | # The theme to use for HTML and HTML Help pages. See the documentation for 91 | # a list of builtin themes. 92 | html_theme = 'nature' 93 | 94 | # Theme options are theme-specific and customize the look and feel of a theme 95 | # further. For a list of options available for each theme, see the 96 | # documentation. 97 | #html_theme_options = {} 98 | 99 | # Add any paths that contain custom themes here, relative to this directory. 100 | #html_theme_path = [] 101 | 102 | # The name for this set of Sphinx documents. If None, it defaults to 103 | # " v documentation". 104 | #html_title = None 105 | 106 | # A shorter title for the navigation bar. Default is the same as html_title. 107 | #html_short_title = None 108 | 109 | # The name of an image file (relative to this directory) to place at the top 110 | # of the sidebar. 111 | #html_logo = None 112 | 113 | # The name of an image file (within the static path) to use as favicon of the 114 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 115 | # pixels large. 116 | #html_favicon = None 117 | 118 | # Add any paths that contain custom static files (such as style sheets) here, 119 | # relative to this directory. They are copied after the builtin static files, 120 | # so a file named "default.css" will overwrite the builtin "default.css". 121 | html_static_path = ['_static'] 122 | 123 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 124 | # using the given strftime format. 125 | #html_last_updated_fmt = '%b %d, %Y' 126 | 127 | # If true, SmartyPants will be used to convert quotes and dashes to 128 | # typographically correct entities. 129 | #html_use_smartypants = True 130 | 131 | # Custom sidebar templates, maps document names to template names. 132 | #html_sidebars = {} 133 | 134 | # Additional templates that should be rendered to pages, maps page names to 135 | # template names. 136 | #html_additional_pages = {} 137 | 138 | # If false, no module index is generated. 139 | #html_domain_indices = True 140 | 141 | # If false, no index is generated. 142 | #html_use_index = True 143 | 144 | # If true, the index is split into individual pages for each letter. 145 | #html_split_index = False 146 | 147 | # If true, links to the reST sources are added to the pages. 148 | #html_show_sourcelink = True 149 | 150 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 151 | #html_show_sphinx = True 152 | 153 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 154 | #html_show_copyright = True 155 | 156 | # If true, an OpenSearch description file will be output, and all pages will 157 | # contain a tag referring to it. The value of this option must be the 158 | # base URL from which the finished HTML is served. 159 | #html_use_opensearch = '' 160 | 161 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 162 | #html_file_suffix = None 163 | 164 | # Output file base name for HTML help builder. 165 | htmlhelp_basename = 'django-dajaxdoc' 166 | 167 | 168 | # -- Options for LaTeX output -------------------------------------------------- 169 | 170 | # The paper size ('letter' or 'a4'). 171 | #latex_paper_size = 'letter' 172 | 173 | # The font size ('10pt', '11pt' or '12pt'). 174 | #latex_font_size = '10pt' 175 | 176 | # Grouping the document tree into LaTeX files. List of tuples 177 | # (source start file, target name, title, author, documentclass [howto/manual]). 178 | latex_documents = [ 179 | ('index', 'django-dajax.tex', u'django-dajax Documentation', 180 | u'Jorge Bastida', 'manual'), 181 | ] 182 | 183 | # The name of an image file (relative to this directory) to place at the top of 184 | # the title page. 185 | #latex_logo = None 186 | 187 | # For "manual" documents, if this is true, then toplevel headings are parts, 188 | # not chapters. 189 | #latex_use_parts = False 190 | 191 | # If true, show page references after internal links. 192 | #latex_show_pagerefs = False 193 | 194 | # If true, show URL addresses after external links. 195 | #latex_show_urls = False 196 | 197 | # Additional stuff for the LaTeX preamble. 198 | #latex_preamble = '' 199 | 200 | # Documents to append as an appendix to all manuals. 201 | #latex_appendices = [] 202 | 203 | # If false, no module index is generated. 204 | #latex_domain_indices = True 205 | 206 | 207 | # -- Options for manual page output -------------------------------------------- 208 | 209 | # One entry per manual page. List of tuples 210 | # (source start file, name, description, authors, manual section). 211 | man_pages = [ 212 | ('index', 'django-dajax', u'django-dajax Documentation', 213 | [u'Jorge Bastida'], 1) 214 | ] 215 | -------------------------------------------------------------------------------- /docs/img/overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jorgebastida/django-dajax/ce515983e907285daf1a0709ade86a1eaa2f1906/docs/img/overview.png -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | django-dajax 2 | ============ 3 | 4 | 5 | Dajax is a powerful tool to easily and super-quickly develop asynchronous presentation logic in web applications, using Python and almost no JavaScript source code. 6 | 7 | It supports four of the most popular JavaScript frameworks: Prototype, jQuery, Dojo and mootols. 8 | 9 | Using ``django-dajaxice`` as communication core, Dajax implements an abstraction layer between presentation logic managed with JavaScript and your Python business logic. 10 | 11 | With Dajax you can modify your DOM structure directly from Python. 12 | 13 | 14 | Documentation 15 | ------------- 16 | .. toctree:: 17 | :maxdepth: 2 18 | 19 | installation 20 | api 21 | 22 | migrating-to-09 23 | 24 | changelog 25 | 26 | 27 | How does it work? 28 | ----------------- 29 | 30 | .. image:: img/overview.png 31 | 32 | 33 | Example 34 | ------- 35 | 36 | Once you've `installed dajaxice `_ and `dajax `_ you can create ajax functions in your Python code:: 37 | 38 | 39 | from dajax.core import Dajax 40 | 41 | def assign_test(request): 42 | dajax = Dajax() 43 | dajax.assign('#box', 'innerHTML', 'Hello World!') 44 | dajax.add_css_class('div .alert', 'red') 45 | return dajax.json() 46 | 47 | 48 | This function will assign to ``#box`` as innerHTML the text ``Hello World!`` and ``Hola!`` to every DOM element that matches ``.btn``. 49 | 50 | You can call this function in your html/js code using:: 51 | 52 |
Click Here!
53 | 54 | 55 | Supported JS Frameworks 56 | ----------------------- 57 | 58 | Dajax currently support four of the most popular: 59 | 60 | * `jQuery 1.7.2 `_ 61 | * `Prototype 1.7 `_ 62 | * `MooTools 1.4.5 `_ 63 | * `Dojo 1.7 `_ 64 | -------------------------------------------------------------------------------- /docs/installation.rst: -------------------------------------------------------------------------------- 1 | Installation 2 | ============ 3 | 4 | In order to use ``dajax`` you should install ``django-dajaxice`` before. Please follow these instructions `here `_. 5 | 6 | Installing Dajax 7 | ---------------- 8 | 9 | Install ``django-dajax`` using ``easy_install`` or ``pip``:: 10 | 11 | $ pip install django_dajax 12 | $ easy_install django_dajax 13 | 14 | 15 | Add ``dajax`` in your project settings.py inside ``INSTALLED_APPS``:: 16 | 17 | INSTALLED_APPS = ( 18 | 'django.contrib.auth', 19 | 'django.contrib.contenttypes', 20 | 'django.contrib.sessions', 21 | 'django.contrib.sites', 22 | 'dajaxice', 23 | 'dajax', 24 | ... 25 | ) 26 | 27 | Create a new ``ajax.py`` file inside your app with your own dajax functions:: 28 | 29 | from dajax.core import Dajax 30 | def multiply(request, a, b): 31 | dajax = Dajax() 32 | result = int(a) * int(b) 33 | dajax.assign('#result','value',str(result)) 34 | return dajax.json() 35 | 36 | 37 | Include dajax in your :: 38 | 39 | Dajax supports up to four JS libraries. You should add to your project base template the one you need. 40 | 41 | * `jQuery 1.7.2 `_ - ``dajax/jquery.dajax.core.js`` 42 | * `Prototype 1.7 `_ - ``dajax/prototype.dajax.core.js`` 43 | * `MooTools 1.4.5 `_ - ``dajax/mootools.dajax.core.js`` 44 | * `Dojo 1.7 `_ - ``dajax/dojo.dajax.core.js`` 45 | 46 | For example for jQuery:: 47 | 48 | {% static "/static/dajax/jquery.dajax.core.js" %} 49 | 50 | 51 | Use Dajax 52 | --------- 53 | 54 | Now you can call your ajax methods using Dajaxice.app.function('Dajax.process'):: 55 | 56 | 57 | 58 | 59 | The function _Dajax.process_ will process what the server returns and call the appropriate actions. 60 | If you need your own callback, you can change the callback with a function like:: 61 | 62 | function my_callback(data){ 63 | Dajax.process(data); 64 | /* Your js code */ 65 | } 66 | 67 | And use it as:: 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM Command file for Sphinx documentation 4 | 5 | if "%SPHINXBUILD%" == "" ( 6 | set SPHINXBUILD=sphinx-build 7 | ) 8 | set BUILDDIR=_build 9 | set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . 10 | if NOT "%PAPER%" == "" ( 11 | set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% 12 | ) 13 | 14 | if "%1" == "" goto help 15 | 16 | if "%1" == "help" ( 17 | :help 18 | echo.Please use `make ^` where ^ is one of 19 | echo. html to make standalone HTML files 20 | echo. dirhtml to make HTML files named index.html in directories 21 | echo. singlehtml to make a single large HTML file 22 | echo. pickle to make pickle files 23 | echo. json to make JSON files 24 | echo. htmlhelp to make HTML files and a HTML help project 25 | echo. qthelp to make HTML files and a qthelp project 26 | echo. devhelp to make HTML files and a Devhelp project 27 | echo. epub to make an epub 28 | echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter 29 | echo. text to make text files 30 | echo. man to make manual pages 31 | echo. changes to make an overview over all changed/added/deprecated items 32 | echo. linkcheck to check all external links for integrity 33 | echo. doctest to run all doctests embedded in the documentation if enabled 34 | goto end 35 | ) 36 | 37 | if "%1" == "clean" ( 38 | for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i 39 | del /q /s %BUILDDIR%\* 40 | goto end 41 | ) 42 | 43 | if "%1" == "html" ( 44 | %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html 45 | if errorlevel 1 exit /b 1 46 | echo. 47 | echo.Build finished. The HTML pages are in %BUILDDIR%/html. 48 | goto end 49 | ) 50 | 51 | if "%1" == "dirhtml" ( 52 | %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml 53 | if errorlevel 1 exit /b 1 54 | echo. 55 | echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. 56 | goto end 57 | ) 58 | 59 | if "%1" == "singlehtml" ( 60 | %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml 61 | if errorlevel 1 exit /b 1 62 | echo. 63 | echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. 64 | goto end 65 | ) 66 | 67 | if "%1" == "pickle" ( 68 | %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle 69 | if errorlevel 1 exit /b 1 70 | echo. 71 | echo.Build finished; now you can process the pickle files. 72 | goto end 73 | ) 74 | 75 | if "%1" == "json" ( 76 | %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json 77 | if errorlevel 1 exit /b 1 78 | echo. 79 | echo.Build finished; now you can process the JSON files. 80 | goto end 81 | ) 82 | 83 | if "%1" == "htmlhelp" ( 84 | %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp 85 | if errorlevel 1 exit /b 1 86 | echo. 87 | echo.Build finished; now you can run HTML Help Workshop with the ^ 88 | .hhp project file in %BUILDDIR%/htmlhelp. 89 | goto end 90 | ) 91 | 92 | if "%1" == "qthelp" ( 93 | %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp 94 | if errorlevel 1 exit /b 1 95 | echo. 96 | echo.Build finished; now you can run "qcollectiongenerator" with the ^ 97 | .qhcp project file in %BUILDDIR%/qthelp, like this: 98 | echo.^> qcollectiongenerator %BUILDDIR%\qthelp\django-dajax.qhcp 99 | echo.To view the help file: 100 | echo.^> assistant -collectionFile %BUILDDIR%\qthelp\django-dajax.ghc 101 | goto end 102 | ) 103 | 104 | if "%1" == "devhelp" ( 105 | %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp 106 | if errorlevel 1 exit /b 1 107 | echo. 108 | echo.Build finished. 109 | goto end 110 | ) 111 | 112 | if "%1" == "epub" ( 113 | %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub 114 | if errorlevel 1 exit /b 1 115 | echo. 116 | echo.Build finished. The epub file is in %BUILDDIR%/epub. 117 | goto end 118 | ) 119 | 120 | if "%1" == "latex" ( 121 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 122 | if errorlevel 1 exit /b 1 123 | echo. 124 | echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. 125 | goto end 126 | ) 127 | 128 | if "%1" == "text" ( 129 | %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text 130 | if errorlevel 1 exit /b 1 131 | echo. 132 | echo.Build finished. The text files are in %BUILDDIR%/text. 133 | goto end 134 | ) 135 | 136 | if "%1" == "man" ( 137 | %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man 138 | if errorlevel 1 exit /b 1 139 | echo. 140 | echo.Build finished. The manual pages are in %BUILDDIR%/man. 141 | goto end 142 | ) 143 | 144 | if "%1" == "changes" ( 145 | %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes 146 | if errorlevel 1 exit /b 1 147 | echo. 148 | echo.The overview file is in %BUILDDIR%/changes. 149 | goto end 150 | ) 151 | 152 | if "%1" == "linkcheck" ( 153 | %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck 154 | if errorlevel 1 exit /b 1 155 | echo. 156 | echo.Link check complete; look for any errors in the above output ^ 157 | or in %BUILDDIR%/linkcheck/output.txt. 158 | goto end 159 | ) 160 | 161 | if "%1" == "doctest" ( 162 | %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest 163 | if errorlevel 1 exit /b 1 164 | echo. 165 | echo.Testing of doctests in the sources finished, look at the ^ 166 | results in %BUILDDIR%/doctest/output.txt. 167 | goto end 168 | ) 169 | 170 | :end 171 | -------------------------------------------------------------------------------- /docs/migrating-to-09.rst: -------------------------------------------------------------------------------- 1 | Migrating to 0.9 2 | ================ 3 | 4 | Static files 5 | ------------ 6 | 7 | Since ``0.9`` dajax takes advantage of ``django.contrib.staticfiles`` so deploying a dajax application live is much easy than in previous versions. 8 | All the ``X.dajax.core.js`` flavoured files (jQuery, Prototype, ...) are inside a new folder named static instead of src. 9 | 10 | You need to remember to run ``python manage.py collectstatic`` before deploying your code live. This command will collect all the static files your application need into ``STATIC_ROOT``. For further information, this is the `Django static files docuemntation `_ 11 | 12 | You should change all you dajax core imports using for example for jQuery:: 13 | 14 | {% static "dajax/jquery.core.js" %} 15 | 16 | 17 | Imports 18 | ------- 19 | If you was importing ``dajax`` using:: 20 | 21 | from dajax.core.Dajax import Dajax 22 | 23 | you should change it to:: 24 | 25 | from dajax.core import Dajax 26 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from distutils.core import setup 2 | 3 | setup( 4 | name='django-dajax', 5 | version='0.9.2', 6 | author='Jorge Bastida', 7 | author_email='me@jorgebastida.com', 8 | description=('Easy to use library to create asynchronous presentation ' 9 | 'logic with django and dajaxice'), 10 | url='http://dajaxproject.com', 11 | license='BSD', 12 | packages=['dajax'], 13 | package_data={'dajax': ['static/dajax/*']}, 14 | long_description=('dajax is a powerful tool to easily and super-quickly ' 15 | 'develop asynchronous presentation logic in web ' 16 | 'applications using python and almost no JS code. It ' 17 | 'supports up to four of the most popular JS frameworks: ' 18 | 'jQuery, Prototype, Dojo and mootols.'), 19 | install_requires=[ 20 | 'django-dajaxice>=0.5' 21 | ], 22 | classifiers=['Development Status :: 4 - Beta', 23 | 'Environment :: Web Environment', 24 | 'Framework :: Django', 25 | 'Intended Audience :: Developers', 26 | 'License :: OSI Approved :: BSD License', 27 | 'Operating System :: OS Independent', 28 | 'Programming Language :: Python', 29 | 'Topic :: Utilities'] 30 | ) 31 | --------------------------------------------------------------------------------