Heya,
> Is there an easy to disable the html version of the application you've written?
Yeah, so on the resource do something like:
from djangorestframework.resource import Resource
from djangorestframework import emitters
MyResource(Resource):
emitters = ( emitters.JSONEmitter,
emitters.DocumentingPlainTextEmitter,
emitters.XMLEmitter)
> Also, is there a way to control if a user is allowed read only or if they
> should be able to create objects through the api?
Do you just mean setting either 'allowed_methods = ('GET',) or 'allowed_methods = ('GET', 'POST') on the resource, or do you mean having a resource that supports both, but some users can do both? For the later, you can use the 'auth' parameter in the handler methods, which will simply be set to the user object (unless you customise the authenticators) So probably something like...
MyResource(ModelResource):
...
def post(self, request, auth, content, num):
# do stuff with auth, and possibly raise a ResponseException 403
super(MyResource, self).post(request, auth, content, num)
This'll get easier with the next version that's planned to be rolled out shortly, which adds proper permissions hooks as well as the authentication that's currently in place.
Hope that helps...
(And glad to hear ya like the framework!)
t.