conf_site/proposals/models.py
def _get_cached_vote_count(self, cache_key, vote_score):
        """Helper method to retrieve cached vote counts."""
        cached_vote_count = cache.get(cache_key, False)
        if cached_vote_count is not False:
            return cached_vote_count
        vote_count = ProposalVote.objects.filter(
            proposal=self, score=vote_score
        ).count()
        # We can use a longer timeout because we update invididual
        # vote counts when ProposalVotes are created or modified.
        cache.set(cache_key, vote_count, settings.CACHE_TIMEOUT_LONG)
        return vote_count
Helper method to retrieve cached vote counts.
Helper method to retrieve cached vote counts.
Helper method to retrieve cached vote counts .
def _get_cached_vote_count(self, cache_key, vote_score):
        cached_vote_count = cache.get(cache_key, False)
        if cached_vote_count is not False:
            return cached_vote_count
        vote_count = ProposalVote.objects.filter(
            proposal=self, score=vote_score
        ).count()
        cache.set(cache_key, vote_count, settings.CACHE_TIMEOUT_LONG)
        return vote_count
def _get_cached_vote_count ( self , cache_key , vote_score ) : cached_vote_count = cache . get ( cache_key , False ) if cached_vote_count is not False : return cached_vote_count vote_count = ProposalVote . objects . filter ( proposal = self , score = vote_score ) . count ( ) cache . set ( cache_key , vote_count , settings . CACHE_TIMEOUT_LONG ) return vote_count
Helper method to retrieve cached vote counts.
Helper method to retrieve cached vote counts .
"""Helper method to retrieve cached vote counts.""" # We can use a longer timeout because we update invididual # vote counts when ProposalVotes are created or modified.
self
cache_key
vote_score