About wq.db.rest

About wq.db.rest

wq.db.rest facilitates the creation of REST-ful APIs that also function as complete websites. When combined with a compatible client library (i.e. wq.app), this flexibility makes it possible to create progressively-enhanced websites that also function well offline (via client-side rendering). While it is nominally a REST interface, wq.db.rest is intended to be used as the core controller in a web application, rather than to build a supplemental API (see "My website is its own REST API"). That said, like the rest of wq.db, individual parts of wq.db.rest you find useful can be integrated into your application without requiring the whole module.

wq.db.rest is heavily influenced by (and directly dependent on) the Django REST Framework (DRF). It is also inspired by the django.contrib.admin automatic admin interface. wq.db.rest brings these ideas together with a ModelRouter that subclasses DRF's DefaultRouter, but takes a model-centric (rather than viewset-centric) approach to route registration and handling.

Background Reading

The following documentation from these other libraries will serve as a useful background to the topics in this section.

Getting Started

Configuration

If you are starting from the Django wq template, you should already have the necessary configuration to continue. If not, the key components are some important settings that should be included in your settings.py, and an entry in your urls.py that references the included ModelRouter's urls.

Model Registration

Once everything is configured, it is just a matter of registering models with the included router. See the routers section for more information.

API Documentation

wq.db.rest includes a number of submodules, many of which are extensions of their equivalents in DRF.