Skip to content

vepkenez/rest2backbone

 
 

Repository files navigation

Intro

This project aims to made easier to develop django application with REST API and rich clients, that are using this API via backbone.js. In django it uses djangorestframework to quickly define RESTful API.

Key features:

  • Generates models and collection definitions in JS from resources and models definitions in django.
  • Backbone Models should contain (as per models/resources definitions in Django):
  • default values
  • validations
  • support to load values from HTML form
  • Collections:
  • support paging and searches and ordering
  • special 'index' collections - just ID and representation of object - can be used in dynamic selects, autocompletes etc.
  • Can generate forms templates (based on models and resources definitions) for use in pages (also read only forms)
  • Forms can:
  • update validation result to form
  • save modified form to server (via rest API - using Backbone models and colections).
  • A sample application - showing how it should be used.

Quick Start

Setup virtual environment and install dependencies virtualenv venv . venv/bin/activate # assuming you're running linux or MacOS. In case of Windows, run venv/bin/activate.bat pip -r requirements.pip

Load sample data ./manage.py loaddata sample_app/fixtures/sample_data.json

Run server ./manage.py runserver

In browser open http://localhost:8000/

In browser (Firefox/Chrome) open developer tools - to see API requests to server - on load/change of models

Look into sample_app directory to see how to use.

More Info

More info will be on project page on my web

Versions:

1.0 - first release

1.0.1 - minor fixes, added support for Textarea widget in templates

1.1 - revamped dynamic widgets to more flexible and extensible model, save - use PATCH when possible

1.2 - more refactoring of dynamic widgets, DynamicEditor (edit related object in place), small fixes

1.2.1 - setup script

1.2.2 - small fixes in forms-api

1.2.3 - added possibility to defer save in FormView, DynamicEditor widget

1.2.4 - some changes to JS - better handling of errors when server is not responding

1.2.5 - fixed to work with django 1.5+ and newer django-rest-framework

1.2.6 - forked by gbezyuk, cleaned up and reformatted for compatibility with PEP8

License:

BSD license (same as Django)

About

django application to work easily with REST API and backbone.js client

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 70.8%
  • Python 26.7%
  • CSS 2.5%