conf_site/proposals/models.py
def _refresh_vote_counts(self):
        """Helper method to manually refresh a proposal's vote counts."""
        vote_count_dict = {
            "proposal_{}_plus_one".format(self.pk): ProposalVote.PLUS_ONE,
            "proposal_{}_plus_zero".format(self.pk): ProposalVote.PLUS_ZERO,
            "proposal_{}_minus_zero".format(self.pk): ProposalVote.MINUS_ZERO,
            "proposal_{}_minus_one".format(self.pk): ProposalVote.MINUS_ONE,
        }
        for cache_key, vote_score in vote_count_dict.items():
            vote_count = ProposalVote.objects.filter(
                proposal=self, score=vote_score
            ).count()
            cache.set(cache_key, vote_count, settings.CACHE_TIMEOUT_LONG)
Helper method to manually refresh a proposal's vote counts.
Helper method to manually refresh a proposal's vote counts.
Helper method to manually refresh a proposal ' s vote counts .
def _refresh_vote_counts(self):
        vote_count_dict = {
            "proposal_{}_plus_one".format(self.pk): ProposalVote.PLUS_ONE,
            "proposal_{}_plus_zero".format(self.pk): ProposalVote.PLUS_ZERO,
            "proposal_{}_minus_zero".format(self.pk): ProposalVote.MINUS_ZERO,
            "proposal_{}_minus_one".format(self.pk): ProposalVote.MINUS_ONE,
        }
        for cache_key, vote_score in vote_count_dict.items():
            vote_count = ProposalVote.objects.filter(
                proposal=self, score=vote_score
            ).count()
            cache.set(cache_key, vote_count, settings.CACHE_TIMEOUT_LONG)
def _refresh_vote_counts ( self ) : vote_count_dict = { "proposal_{}_plus_one" . format ( self . pk ) : ProposalVote . PLUS_ONE , "proposal_{}_plus_zero" . format ( self . pk ) : ProposalVote . PLUS_ZERO , "proposal_{}_minus_zero" . format ( self . pk ) : ProposalVote . MINUS_ZERO , "proposal_{}_minus_one" . format ( self . pk ) : ProposalVote . MINUS_ONE , } for cache_key , vote_score in vote_count_dict . items ( ) : vote_count = ProposalVote . objects . filter ( proposal = self , score = vote_score ) . count ( ) cache . set ( cache_key , vote_count , settings . CACHE_TIMEOUT_LONG )
Helper method to manually refresh a proposal's vote counts.
Helper method to manually refresh a proposal ' s vote counts .
"""Helper method to manually refresh a proposal's vote counts."""
self