예제 #1
0
파일: views.py 프로젝트: GitBulk/polls-api
    def get_actions(self):
        actions = {}

        if can_delete_question(self.get_object(), self.request):
            actions['delete'] = Action(method='DELETE', attributes=None)

        return actions
예제 #2
0
파일: views.py 프로젝트: GitBulk/polls-api
    def get_actions(self):
        actions = {}

        if can_vote_choice(self.request):
            actions['vote'] = Action(method='POST', attributes=None)

        return actions
예제 #3
0
    def get_actions(self):
        actions = {}

        if can_create_question(self.request):
            actions['create'] = Action(method='POST', attributes=(
                Attribute(name='question', category='text'),
                Attribute(name='choices', category='array[text]'),
            ))

        return actions
예제 #4
0
 def get_actions(self):
     return {'delete': Action(method='DELETE', attributes=None)}