def get_actions(self): actions = {} if can_delete_question(self.get_object(), self.request): actions['delete'] = Action(method='DELETE', attributes=None) return actions
def get_actions(self): actions = {} if can_vote_choice(self.request): actions['vote'] = Action(method='POST', attributes=None) return actions
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
def get_actions(self): return {'delete': Action(method='DELETE', attributes=None)}