A Django app for editing and publishing arbitrary JSON data in a form-based environment.
Project description
mohawk-data-platform is a Django app for editing and publishing arbitrary JSON data in a form-based environment.
Features
Define structured models, with custom fields and validation.
Create, edit and update instances defined models using the Django admin interface.
Group models into applications for bulk access.
Access models, instances and applications via a simple JSON API.
Cross-origin API requests via CORS and JSONP.
Installation
Checkout the latest mohawk-data-platform release and copy or symlink the data directory into your PYTHONPATH. If using pip, run pip install mohawk-data-platform.
Add 'data' to your INSTALLED_APPS setting.
Add url(r"^", include("data.urls", namespace="data")), to you urls.py file.
Install and active the Django admin site, if not already present.
Admin usage
The bulk of the functionality for mohawk-data-platform is found within the admin UI. The basic workflow is:
Create a Model, defining at least one Field.
Create an Instance of that model.
Optionally, create an Application.
Edit the model, and add it to the application you created.
Any data you add to the system will be pubically-available via the API endpoints.
Model field reference
Fields added to a model take a number of optional config parameters, suppled as JSON documents. The available fields, and their configuration options, are listed below.
Fields which take choices expect them to be supplied as a list of [value, label] options:
{ "choices": [ ["#ff0000", "Red"], ["#0000ff", "Green"], ["#00ff00", "Blue"] ] }
Text
A single-line of unicode text.
{ "required": true, "choices": null }
Integer
An integer number.
{ "required": true, "choices": null }
Float
A floating-point number.
{ "required": true }
Date
A date value.
{ "required": true }
Time
A time value.
{ "required": true }
Datetime
A combined date and time value.
{ "required": true }
Boolean
A true/false checkbox.
{}
File
An uploaded file.
{ "required": true }
Long text
Multiple lines of unicode text.
{ "required": true }
Model
A reference to an instance of a model.
{ "required": true, "model_id": "<model_id>" // The type of instance being referenced. }
Multi model
A reference to multiple instances of a model.
{ "required": true, "model_id": "<model_id>" // The type of instance being referenced. }
API endpoints
GET /<model_id>.json
Returns all online instances of the given model:
{ "status": "OK", "message": "Instances of Your Model were successfully loaded.", "instances": [ { "_date_created": "<timestamp>", "_date_modified": "<timestamp>", "_id": "<instance_id>", "_model": "<model_id>", "<field_name>": "<field_value>", ... }, ... ] }
GET /<model_id>/<instance_id>.json
Returns the given instance:
{ "status": "OK", "message": "Instances of <model_name> were successfully loaded.", "instance": { "_date_created": "<timestamp>", "_date_modified": "<timestamp>", "_id": "<instance_id>", "_model": "<model_id>", "<field_name>": "<field_value>", ... } }
GET /a/<application_id>.json
Returns all online instances within the given application:
{ "status": "OK", "message": "Instances within application <application_name> were successfully loaded.", "instances": [ { "_date_created": "<timestamp>", "_date_modified": "<timestamp>", "_id": "<instance_id>", "_model": "<model_id>", "<field_name>": "<field_value>", ... }, ... ] }
More information
The mohawk-data-platform project was developed at Mohawk, and is released as Open Source under the MIT license.
You can get the code from the mohawk-data-platform project site.
Contributors
The following people were involved in the development of this project.
Dave Hall - Blog | GitHub | Twitter | Google Profile
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file mohawk-data-platform-0.9.3.tar.gz
.
File metadata
- Download URL: mohawk-data-platform-0.9.3.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4a8b130068f8237cb48e6bafef593e0bb3365c20be6de75c36d777e91d80242 |
|
MD5 | 1e7b267f2ac56e0286dbe20312d15ee6 |
|
BLAKE2b-256 | 7b2cc0fe7b8a22e1a9482ffdbd23298b8951fe80c0f1d06f73c1e459bc2adfe3 |