import datetime
from django.contrib.auth.models import User
-from django.contrib.sessions.backends.db import SessionStore
from django.core.exceptions import ObjectDoesNotExist
from karmaworld.apps.users.models import NoteKarmaEvent
import os
def process_note_thank_events(request_user, note):
# Give points to the person who uploaded this note
- if note.user != request_user:
+ if note.user != request_user and note.user:
NoteKarmaEvent.create_event(note.user, note, NoteKarmaEvent.THANKS)
NoteKarmaEvent.create_event(request_user, note, NoteKarmaEvent.GIVE_FLAG)
# If this is the 6th time this note has been flagged,
# punish the uploader
- if note.flags == 6:
+ if note.flags == 6 and note.user:
NoteKarmaEvent.create_event(note.user, note, NoteKarmaEvent.GET_FLAGGED)
# Copyright (C) 2013 FinalsClub Foundation
import logging
import datetime
+from allauth.account.signals import email_confirmed, email_added
from django.contrib.auth.models import User
from django.db.models import Sum
from django.db.models.signals import post_save
return self.user.__unicode__()
+@receiver(email_confirmed, weak=True)
+def give_email_confirm_karma(sender, **kwargs):
+ GenericKarmaEvent.create_event(kwargs['email_address'].user, "You confirmed your email address", 5)
+
+
class BaseKarmaEvent(models.Model):
points = models.IntegerField()
user = models.ForeignKey(User)