Today I've though about a concept I might try to implement someday. Meanwhile, if you have more spare time than me, feel free to give it a try ;)
What I've thought is simply reflecting Django's ORM in JavaScript. The principle is quite simple and JavaScript allow a syntax somewhat similar to Django.
Here's what it could looks like:
// Create the ORM object and map it to the specified app/model
var User = $.django.from('django.contrib.auth.models').import('User');
// Store the query
var queryset = User.objects.order_by('?').filter({is_active: 'True'});
// Access the cached query or request it if not cached
// and use the result
queryset.each(function(){
$('<li></li>').text(this.username).appendTo('ul#user-list');
});
The implementation doesn't look like a big challenge, although the translating requests with JSON isn't a simple task.
The biggest challenge in my opinion is making all this secure. How to expose only certain models to certain users and manage these permissions ?
no comments :|