Exemplo n.º 1
0
    def pledge(self, geuser):
        """geuser pledges to perform this action.
        Records the Pledge, posts a message to community feed, and clears relevant caches"""

        _, is_created = Pledge.objects.get_or_create(action = self, user = geuser)

        if is_created:
            entry = Entry(who = geuser,
                          msg = 'pledged to <strong>%s</strong>' % self.title,
                          campaign = self.campaign)
            entry.save()
            EntryView.refresh_recent_activity(self.campaign)
            Entry.objects.clear_dashboard_cache(self.campaign)

        Action.objects.clear_dashboard_cache(self.campaign)