# Take a point away from person flagging this course
if request_user.is_authenticated():
CourseKarmaEvent.create_event(request_user, course, CourseKarmaEvent.GIVE_FLAG)
- # If this is the 6th time this course has been flagged,
- # punish the uploader
- if course.flags == 6:
- CourseKarmaEvent.create_event(course.user, course, CourseKarmaEvent.GET_FLAGGED)
def flag_course(request, pk):
class CourseKarmaEvent(BaseKarmaEvent):
GIVE_FLAG = 'give_flag'
- GET_FLAGGED = 'get_flagged'
EVENT_TYPE_CHOICES = (
(GIVE_FLAG, "You flagged a course"),
- (GET_FLAGGED, "Your course was flagged as spam"),
)
course = models.ForeignKey('courses.Course')
event_type = models.CharField(max_length=15, choices=EVENT_TYPE_CHOICES)
POINTS = {
GIVE_FLAG: -1,
- GET_FLAGGED: -100
}
def get_message(self):