I'm not sure what your specific need is (let me know and I can elaborate,) but I think the best way to accomplish what you're looking for is to invest some time developing a REST interface.
Defining each python model as a resource will take the guess work out of the interface. There are even concepts in REST for defining "rel" links which expand upon what states are available to transition to.
Say you have a back end User
model that looks like:
{
id: 1,
name: "Bob Loblaw",
email: "bobloblaw@lawblog.com"
}
You could expose this model as a resource accessible at /user
Then in your client code you could create a User
service which returns $resource('/user/:userId', {userId:'@id'});
Now that you have your User
resource (accessible via a User
service you have wired into your module...) All you need is to inject the resource into your controller and hack away:
// grab a user to display
$scope.user = User.get({userId:1});
// perform an update on a user
var user = User.get({userId:1}, function() {
user.email = 'bob@lawblog.com';
user.$save();
});
// delete a user
User.delete({userId:1});
// etc...
Rather than automating model & route generation based on back end code, see if developing a restful interface which is self-defining would serve your needs.