Exemple #1
0
    def get_actions(self):
        actions = {}

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

        return actions
Exemple #2
0
    def get_actions(self):
        actions = {}

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

        return actions
Exemple #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
Exemple #4
0
 def get_actions(self):
     return {'delete': Action(method='DELETE', attributes=None)}