{"_id":"@elcar-gps/backbone-tastypie","name":"@elcar-gps/backbone-tastypie","dist-tags":{"latest":"0.2.0"},"versions":{"0.2.0":{"name":"@elcar-gps/backbone-tastypie","main":"backbone_tastypie/static/js/backbone-tastypie.js","description":"A small compatibility layer to make backbone.js and django-tastypie work together happily.","homepage":"https://github.com/PaulUithol/backbone-tastypie","keywords":["backbone","django","tastypie","REST","compatibility"],"repository":{"type":"git","url":"git+https://github.com/PaulUithol/backbone-tastypie.git"},"author":{"name":"Paul Uithol","email":"https://github.com/PaulUithol"},"contributors":"Listed at <https://github.com/PaulUithol/backbone-tastypie/contributors>","dependencies":{"underscore":">=1.4.4","backbone":">=1.0.0"},"license":"MIT","version":"0.2.0","gitHead":"c720b9db02a60af103f8ed9247584fda74166f65","bugs":{"url":"https://github.com/PaulUithol/backbone-tastypie/issues"},"_id":"@elcar-gps/backbone-tastypie@0.2.0","_nodeVersion":"16.20.0","_npmVersion":"8.19.4","dist":{"integrity":"sha512-1ibRY/Hs7c/M7LajA+rq+2YFQM8o1H5RC7nGJR3qsVP0GDGVIDdPA0DMzFvnoO2ARwxOVEZ35Z9UHOpSogYNVA==","shasum":"f887e1588cc2b1c47b90d5c6455458f3e4d681b0","tarball":"https://registry.npmjs.org/@elcar-gps/backbone-tastypie/-/backbone-tastypie-0.2.0.tgz","fileCount":7,"unpackedSize":10622,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFydAJoVeGKa4YEjGH54v8S2QF00GV6vVZ5dQAOY32urAiEA7ej7MDIeQ/O62yOoSirfFMrrfWEdxkflhOMXMK98jwY="}]},"_npmUser":{"name":"elcargps","email":"tomasz.r@elcar-gps.com.pl"},"directories":{},"maintainers":[{"name":"elcargps","email":"tomasz.r@elcar-gps.com.pl"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/backbone-tastypie_0.2.0_1687355536125_0.08920318888787326"},"_hasShrinkwrap":false}},"time":{"created":"2023-06-21T13:52:16.051Z","0.2.0":"2023-06-21T13:52:16.305Z","modified":"2023-06-21T13:52:16.470Z"},"maintainers":[{"name":"elcargps","email":"tomasz.r@elcar-gps.com.pl"}],"description":"A small compatibility layer to make backbone.js and django-tastypie work together happily.","homepage":"https://github.com/PaulUithol/backbone-tastypie","keywords":["backbone","django","tastypie","REST","compatibility"],"repository":{"type":"git","url":"git+https://github.com/PaulUithol/backbone-tastypie.git"},"contributors":"Listed at <https://github.com/PaulUithol/backbone-tastypie/contributors>","author":{"name":"Paul Uithol","email":"https://github.com/PaulUithol"},"bugs":{"url":"https://github.com/PaulUithol/backbone-tastypie/issues"},"license":"MIT","readme":"# Backbone-tastypie\nA small conversion layer to make [backbone.js](https://github.com/documentcloud/backbone) work together happily with\n[django-tastypie](https://github.com/toastdriven/django-tastypie). Other REST APIs conforming to the same style are\nalso compatible. See for example [TastyMongo](https://github.com/ProgressiveCompany/TastyMongo).\n\nBackbone-tastypie is available under the [MIT license](https://github.com/PaulUithol/backbone-tastypie/blob/master/LICENSE.txt).\n\nBackbone-tastypie depends on [Backbone](https://github.com/documentcloud/backbone) (1.0.0 or newer),\nand thus on [Underscore](https://github.com/documentcloud/underscore) (1.4.4 or newer).\n\n## Contents\n\n* [Installation](#installation)\n* [How it works](#how-it-works)\n* [Settings](#settings)\n* [Methods](#methods)\n\n## Installation\n\nAdd `backbone_tastypie` to your `INSTALLED_APPS` setting, and add the following to your base template:\n\n```html\n<script type=\"text/javascript\" src=\"{{ STATIC_URL }}js/underscore.js\"></script>\n<script type=\"text/javascript\" src=\"{{ STATIC_URL }}js/backbone.js\"></script>\n<script type=\"text/javascript\" src=\"{{ STATIC_URL }}js/backbone-tastypie.js\"></script>\n```\n\n## How it works\n\nBackbone-tastypie overrides several Backbone methods for compatibility with django-tastypie. These mainly have to do\nwith `Backbone.sync`, building urls for models and collections, and parsing data.\n\n## Settings\n\nBackbone-tastypie supports several global API settings in the `Backbone.Tastypie` namespace.\n\n##### doGetOnEmptyPostResponse\n\nDefault: `true`\n\nBy default, Tastypie doesn't return data after a `POST`. Enabling this setting performs an extra `GET` request to fetch\nnew data for the newly created model from the server. If you have control over the server, you can also enable the\n[always-return-data](http://django-tastypie.readthedocs.org/en/latest/resources.html#always-return-data)\noption on your (Model)Resources.\n\n##### doGetOnEmptyPutResponse\n\nDefault: `false`\n\nBy default, Tastypie doesn't return data after a `PUT`. Enabling this setting performs an extra `GET` request to fetch\nnew data for the updated model from the server. If you have control over the server, you can also enable the\n[always-return-data](http://django-tastypie.readthedocs.org/en/latest/resources.html#always-return-data)\noption on your (Model)Resources.\n\n##### apiKey\n\nAn object containing a `username` and a `key`.\n\n##### csrfToken\n\nSet the current csrf token. See https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ajax. You can also load the\nvalue from a cookie like this (provided you have the jQuery.cookie plugin installed):\n\n```javascript\nBackbone.Tastypie.csrfToken = $.cookie( 'csrftoken' );\n```\n\n## Methods\n\n##### Backbone.sync\n\n`Backbone.sync` is overridden to perform an additional `GET` request if there is no response body after creating an object\n(see `doGetOnEmptyPostResponse`), or after updating an object (see `doGetOnEmptyPutResponse`).\n\n##### Backbone.Model.prototype.url\n\n##### Backbone.Model.prototype.parse\n\n##### Backbone.Collection.prototype.parse\n\n##### Backbone.Collection.prototype.url\n\n`Backbone.Collection.prototype.url` is overridden so it can build urls for a set of models. This is for example useful\nwhen using the `fetchRelated` method in [Backbone-relational](https://github.com/PaulUithol/Backbone-relational/).\n","readmeFilename":"README.md"}