X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/efc62f41304bf4bd783018f6008f3472f4c4ad92..7cfc5ea8f76730baa69b1beabf40394ad8babbcc:/forum/actions/meta.py diff --git a/forum/actions/meta.py b/forum/actions/meta.py index 5063746..b16f4f9 100644 --- a/forum/actions/meta.py +++ b/forum/actions/meta.py @@ -2,7 +2,7 @@ from django.utils.translation import ugettext as _ from django.db.models import F from forum.models.action import ActionProxy, DummyActionProxy from forum.models import Vote, Flag -import settings +from forum import settings class VoteAction(ActionProxy): def update_node_score(self, inc): @@ -15,7 +15,7 @@ class VoteAction(ActionProxy): vote.save() def cancel_action(self): - vote = self.vote.all()[0] + vote = self.vote self.update_node_score(-vote.value) vote.delete() @@ -98,7 +98,7 @@ class FlagAction(ActionProxy): DeleteAction(node=self.node, user=self.user, extra="BYFLAGGED").save() def cancel_action(self): - self.flag.all()[0].delete() + self.flag.delete() self.node.reset_flag_count_cache() @classmethod @@ -196,6 +196,9 @@ class DeleteAction(ActionProxy): else: return _("flagged by multiple users: ") + "; ".join([f.extra for f in FlagAction.objects.filter(node=self.node)]) +class UnknownAction(ActionProxy): + pass + class QuestionViewAction(DummyActionProxy): def __init__(self, node, user, ip=None):