Skip to content

kezabelle/django-ajaxinclude

Repository files navigation

The ajax-include-pattern for Django

author

Keryn Knight:

status

Proof of concept

If you've got a bunch of ajax requests in your app, you could potentially ease the HTTP round-trips by using the Ajax-include pattern as demonstrated by Filament Group. They published the library, and a bunch of code into a GitHub repository, which inspired me to hack up this proof of concept.

Giving it a spin

This assumes you're familiar with Django, virtualenv, virtualenvwrapper, and git, and are on a sensible operating system:

$ mkvirtualenv throwaway
$ git clone https://github.com/kezabelle/django-ajaxinclude.git
$ cd django-ajaxinclude
$ python setup.py develop
$ cd demo
$ ./run.py syncdb --noinput
$ ./run.py

Open your browser and point it at http://127.0.0.1:8000, and see that everything works. You'll probably need to open your browser's developer console to see the number of requests being made.

What it does

If you've had a quick look at it, you'll note that the data changes every time you refresh. This is because behind the scenes, the provided AjaxIncludeProxy view actually attempts to resolve and call every URL passed to it in request.GET['files']. Currently it does so very naively, but I'll flesh it out to handle errors and exceptions at some point.

Dependencies

First and foremost:

  • Django 1.4 (all I've tried so far)
  • ajaxInclude.js v0.1.0 - 2012-08-17 - da58c8867aa56b03c0799ea7d0b6baaaae228d97

Beyond that, for the purposes of testing it out via the method documented above, you'll require:

About

Scratching an itch about using Django with the @filamentgroup Ajax-Include Pattern.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published