Django Piston - how can I create custom methods?
- by orokusaki
I put my questions in the code comments for clarity:
from piston.handler import AnonymousBaseHandler
class AnonymousAPITest(AnonymousBaseHandler):
    fields = ('update_subscription',)
    def update_subscription(self, request, months):
        # Do some stuff here to update a subscription based on the
        # number of months provided.
        # How the heck can I call this method?
        return {'msg': 'Your subscription has been updated!'}
    def read(self, request):
        return {
            'msg': 'Why would I need a read() method on a fully custom API?'
        }