parameters: (self, bundle)
docstring: Shows the vote related to the action, if any
docstring_summary: Shows the vote related to the action, if any
docstring_tokens: Shows the vote related to the action if any
function: def dehydrate_vote(self, bundle):
          '''
          Shows the vote related to the action, if any
          '''
          if bundle.obj.verb == "voted" and bundle.obj.action_object_content_type.name == "election":
              vote = CastVote.objects.get(action_id=bundle.obj.id)
  
              class CastVoteResource(GenericResource):
                  is_changed = fields.BooleanField()
                  question = fields.DictField()
                  user_info = fields.DictField()
  
                  class Meta:
                      queryset = CastVote.objects.all()
                      list_allowed_methods = []
                      detail_allowed_methods = ['get']
                      fields = ['is_public', 'is_direct', 'id', 'resource_uri', 'reason']
  
                  def dehydrate_is_changed(self, bundle):
                      return bundle.obj.is_changed_vote()
  
                  def dehydrate_question(self, bundle):
                      if bundle.obj.is_direct and bundle.obj.is_public and bundle.obj.is_plaintext():
                          return bundle.obj.get_first_pretty_answer()
                      else:
                          return dict()
  
                  def dehydrate_user_info(self, bundle):
                      return dict(
                          short_description=bundle.obj.voter.get_profile().get_short_description(),
                          num_agoras=bundle.obj.voter.agoras.count(),
                          num_votes=bundle.obj.voter.get_profile().count_direct_votes()
                      )
  
              cvr = CastVoteResource()
              bundle = cvr.build_bundle(obj=vote, request=bundle.request)
              bundle = cvr.full_dehydrate(bundle)
              return bundle
          else:
              return dict()
function_tokens: def dehydrate_vote ( self , bundle ) : if bundle . obj . verb == "voted" and bundle . obj . action_object_content_type . name == "election" : vote = CastVote . objects . get ( action_id = bundle . obj . id ) class CastVoteResource ( GenericResource ) : is_changed = fields . BooleanField ( ) question = fields . DictField ( ) user_info = fields . DictField ( ) class Meta : queryset = CastVote . objects . all ( ) list_allowed_methods = [ ] detail_allowed_methods = [ 'get' ] fields = [ 'is_public' , 'is_direct' , 'id' , 'resource_uri' , 'reason' ] def dehydrate_is_changed ( self , bundle ) : return bundle . obj . is_changed_vote ( ) def dehydrate_question ( self , bundle ) : if bundle . obj . is_direct and bundle . obj . is_public and bundle . obj . is_plaintext ( ) : return bundle . obj . get_first_pretty_answer ( ) else : return dict ( ) def dehydrate_user_info ( self , bundle ) : return dict ( short_description = bundle . obj . voter . get_profile ( ) . get_short_description ( ) , num_agoras = bundle . obj . voter . agoras . count ( ) , num_votes = bundle . obj . voter . get_profile ( ) . count_direct_votes ( ) ) cvr = CastVoteResource ( ) bundle = cvr . build_bundle ( obj = vote , request = bundle . request ) bundle = cvr . full_dehydrate ( bundle ) return bundle else : return dict ( )