Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #4 from areski/master

Installer Setup / Readme fixes
  • Loading branch information...
commit dea127c99af91a203037a9a5e5bfaa43f8e558ff 2 parents a04f78f + 653d113
@PaulUithol authored
Showing with 33 additions and 2 deletions.
  1. +6 −0 MANIFEST.in
  2. +2 −2 README.md
  3. +25 −0 setup.py
View
6 MANIFEST.in
@@ -0,0 +1,6 @@
+global-exclude *.pyc
+
+include README.md
+
+recursive-include admin_tools_stats *
+recursive-include backbone_tastypie *
View
4 README.md
@@ -2,10 +2,10 @@
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:
+Add `backbone_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/).
+`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
25 setup.py
@@ -1,6 +1,30 @@
#!/usr/bin/env python
from distutils.core import setup
+import os
+
+# taken from django-registration
+# Compile the list of packages available, because distutils doesn't have
+# an easy way to do this.
+packages, data_files = [], []
+root_dir = os.path.dirname(__file__)
+if root_dir:
+ os.chdir(root_dir)
+
+for dirpath, dirnames, filenames in os.walk('backbone_tastypie'):
+ # Ignore dirnames that start with '.'
+ for i, dirname in enumerate(dirnames):
+ if dirname.startswith('.'): del dirnames[i]
+ if '__init__.py' in filenames:
+ pkg = dirpath.replace(os.path.sep, '.')
+ if os.path.altsep:
+ pkg = pkg.replace(os.path.altsep, '.')
+ packages.append(pkg)
+ elif filenames:
+ prefix = dirpath[len('backbone_tastypie/'):] # Strip "backbone_tastypie/"
+ for f in filenames:
+ data_files.append(os.path.join(prefix, f))
+print data_files
setup(
name='Backbone-tastypie',
version='1.0',
@@ -10,4 +34,5 @@
author_email='paul.uithol@gmail.com',
url='https://github.com/PaulUithol',
packages=['backbone_tastypie'],
+ package_data={'backbone_tastypie': data_files},
)
Please sign in to comment.
Something went wrong with that request. Please try again.