A Node.js admin site tool inspired by the Django framework admin site tool.
MIT License
A Node.js admin site tool inspired by the Django framework admin site tool.
It requires express and mongoose.
Theres is a demo app in the demo dir. There are example config files, models, views and stylesheets you can use in your own project. We are using Bootstrap in the demo app, but it's not required.
We are in an early development stage, so the project is not fully functional.
There is absolutely no concern about backward compatibility until version 0.1.0 is reached.
$ npm install node-django-admin
You can copy the example files to your app and modify then:
Copy the folder demo/views/admin to your_app_views_dir/admin.
Copy the folder demo/public/admin to your_public_dir/admin.
Example models are in the demo/models dir.
The models must have the following requirements:
Initialize the admin interface after initializing express:
// Bootstrap admin site
admin.config(app, mongoose, '/admin');
This must be called before configure express router:
app.use(app.router);
Register the mongoose models in the admin interface:
Example:
/**
* Register the model in the admin interface
*/
admin.add({
path: 'users',
model: 'User',
list: [ 'name', 'email', 'client', 'role' ],
edit: [ 'name', 'email', 'client', 'role' ],
fields: {
'name': {
header: 'Name'
},
'email': {
header: 'Email',
widget: 'email'
},
'client': {
header: 'Client',
widget: 'ref',
model: 'Client',
display: 'name',
field: '_client'
},
'role': {
header: 'Role',
widget: 'sel',
values: ['admin', 'client', 'staff']
}
}
});