From 2a7ea0f6a73c23ee1424f50634058bcef2dc7518 Mon Sep 17 00:00:00 2001 From: Charles Connell Date: Tue, 13 May 2014 14:26:23 -0400 Subject: [PATCH] Karma point for creating a new keyword --- karmaworld/apps/notes/views.py | 1 + karmaworld/apps/users/models.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/karmaworld/apps/notes/views.py b/karmaworld/apps/notes/views.py index 04203e1..d491cf3 100644 --- a/karmaworld/apps/notes/views.py +++ b/karmaworld/apps/notes/views.py @@ -220,6 +220,7 @@ class NoteKeywordsView(FormView, SingleObjectMixin): keyword_object = Keyword.objects.get(id=id) except (ValueError, ObjectDoesNotExist): keyword_object = Keyword() + NoteKarmaEvent.create_event(self.request.user, self.get_object(), NoteKarmaEvent.CREATED_KEYWORD) keyword_object.note = self.get_object() keyword_object.word = word diff --git a/karmaworld/apps/users/models.py b/karmaworld/apps/users/models.py index 7816b61..1caea61 100644 --- a/karmaworld/apps/users/models.py +++ b/karmaworld/apps/users/models.py @@ -165,6 +165,7 @@ class NoteKarmaEvent(BaseKarmaEvent): GET_FLAGGED = 'get_flagged' DOWNLOADED_NOTE = 'downloaded' HAD_NOTE_DOWNLOADED = 'was_downloaded' + CREATED_KEYWORD = 'created_keyword' EVENT_TYPE_CHOICES = ( (UPLOAD, "You uploaded a note"), @@ -174,6 +175,7 @@ class NoteKarmaEvent(BaseKarmaEvent): (GET_FLAGGED, "Your note was flagged as spam"), (DOWNLOADED_NOTE, "You downloaded a note"), (HAD_NOTE_DOWNLOADED, "Your note was downloaded"), + (CREATED_KEYWORD, "You created a keyword"), ) note = models.ForeignKey('notes.Note') event_type = models.CharField(max_length=15, choices=EVENT_TYPE_CHOICES) @@ -186,6 +188,7 @@ class NoteKarmaEvent(BaseKarmaEvent): GET_FLAGGED: -100, DOWNLOADED_NOTE: -2, HAD_NOTE_DOWNLOADED: 2, + CREATED_KEYWORD: 1, } def get_message(self): -- 2.25.1