joestump/django-ajax — pull request #25 by toast38coza (2012-02-02 20:52:39+00:00)
Title: Add list as base method and allowed_methods decorator

Hey, me again:

I added list() to the ModelEndpoint base class so that it is now automatically available at:

/ajax/{app}/{model}/list.json

I also added a decorator called allowed_methods which can be used to limit the methods that can be accessed on a ModelEndpoint.

The idea is that you decorate your ModelEndpoint's authenticate model with it.

Something like:

class CategoryEndpoint(ajax.endpoints.ModelEndpoint):

@allowed_methods(['get','list'])
def authenticate(self, request, application, method):
return True

...

I also updated the README to reflect these changes.

As before .. feel free to use or discard as you like :)