from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User as DjangoUser, AnonymousUser as DjangoAnonymousUser
from django.db.models import Q
-try:
- from hashlib import md5
-except:
- from md5 import new as md5
import string
from random import Random
def can_delete_comment(self, comment):
return self == comment.author or self.reputation >= int(settings.REP_TO_DELETE_COMMENTS)
- @true_if_is_super_or_staff
def can_convert_comment_to_answer(self, comment):
- return self == comment.author or self.reputation >= int(settings.REP_TO_CONVERT_COMMENTS_TO_ANSWERS)
+ return (comment.parent.node_type in ('question', 'answer')) and (self.is_superuser or self.is_staff or (
+ self == comment.author) or (self.reputation >= int(settings.REP_TO_CONVERT_COMMENTS_TO_ANSWERS)))
def can_convert_to_comment(self, answer):
return (not answer.marked) and (self.is_superuser or self.is_staff or answer.author == self or self.reputation >= int