def save(self):
        """
        Saves a new rating - authenticated users can update the
        value if they've previously rated.
        """
        user = self.request.user
        self.undoing = False
        rating_value = self.cleaned_data["value"]
        manager = self.rating_manager

        if user.is_authenticated():
            rating_instance, created = manager.get_or_create(user=user,
                defaults={'value': rating_value})
            if not created:
                if rating_instance.value == int(rating_value):
                    # User submitted the same rating as previously,
                    # which we treat as undoing the rating (like a toggle).
                    rating_instance.delete()
                    self.undoing = True
                else:
                    rating_instance.value = rating_value
                    rating_instance.save()
        else:
            rating_instance = manager.create(value=rating_value)
        return rating_instance
Saves a new rating - authenticated users can update the
        value if they've previously rated.