Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote-tracking branch 'remotes/lincolnloop/master'

  • Loading branch information...
commit a2d1da77b52d7550085cdc67cb2335dc0d0e9605 2 parents 41ca1ba + c3f3191
@PaulUithol PaulUithol authored
View
5 README.md
@@ -1,6 +1,11 @@
# Backbone-tastypie
A small conversion layer to make [backbone.js](https://github.com/documentcloud/backbone) and [django-tastypie](https://github.com/toastdriven/django-tastypie) work together happily.
+## Usage
+Add `django_tastypie` to your `INSTALLED_APPS` setting, and add the following to your base template:
+`<script type="text/javascript" src="{{ STATIC_URL }}js/backbone-tastypie.js"></script>`
+
+## How it works
Specifically, it overrides `Backbone.sync` to do a GET request after creating an object (if there is no response body), and overrides `Backbone.Model.prototype.idAttribute`, `Backbone.Model.prototype.url`, `Backbone.Model.prototype.parse` and `Backbone.Collection.prototype.parse`.
`Backbone.Collection.prototype.url` is overridden so it can build urls for a set of models when using the `fetchRelated` method in [Backbone-relational](https://github.com/PaulUithol/Backbone-relational/).
View
0  backbone_tastypie/__init__.py
No changes.
View
0  backbone-tastypie.js → ...e_tastypie/static/js/backbone-tastypie.js
File renamed without changes
View
13 setup.py
@@ -0,0 +1,13 @@
+#!/usr/bin/env python
+from distutils.core import setup
+
+setup(
+ name='Backbone-tastypie',
+ version='1.0',
+ description='A small conversion layer to make backbone.js and '
+ 'django-tastypie work together happily.',
+ author='Paul Uithol',
+ author_email='paul.uithol@gmail.com',
+ url='https://github.com/PaulUithol',
+ packages=['backbone_tastypie'],
+)
View
2  test/index.html
@@ -10,7 +10,7 @@
<script type="text/javascript" src="./lib/underscore.js"></script>
<script type="text/javascript" src="./lib/backbone.js"></script>
<script type="text/javascript" src="./lib/backbone-relational.js"></script>
- <script type="text/javascript" src="../backbone-tastypie.js"></script>
+ <script type="text/javascript" src="../backbone_tastypie/static/js/backbone-tastypie.js"></script>
<!--<script type="text/javascript" src="http://code.jquery.com/qunit/git/qunit.js"></script>-->
<script type="text/javascript" src="./lib/qunit.js"></script>
Please sign in to comment.
Something went wrong with that request. Please try again.