Ejemplo n.º 1
0
    def save(self):
        post = self.initial["post"]
        user = self.initial["user"]
        parent_object = self.initial["parent_object"]

        new_comment = Comment()
        new_comment.comment = self.cleaned_data["comment"]
        new_comment.post = post
        new_comment.user = user
        new_comment.object_id = parent_object.id
        new_comment.content_type = ContentType.objects.get_for_model(parent_object)
        new_comment.is_active = True
        new_comment.activation_code = 0
        new_comment.save()
Ejemplo n.º 2
0
    def save(self):
        post = self.initial["post"]
        user = self.initial["user"]
        parent_object = self.initial["parent_object"]

        new_comment = Comment()
        new_comment.comment = self.cleaned_data["comment"]
        new_comment.post = post
        new_comment.user = user
        new_comment.object_id = parent_object.id
        new_comment.content_type = ContentType.objects.get_for_model(
            parent_object)
        new_comment.is_active = True
        new_comment.activation_code = 0
        new_comment.save()
Ejemplo n.º 3
0
 def save(self):
     parent_object = self.initial["parent_object"]
     email = self.cleaned_data["email"]
     post = self.initial["post"]
     random_int = random.random()*9999
     activation_code = hashlib.sha224("%s:%s"%(email,random_int)).hexdigest()[:50]
     print activation_code
     new_comment = Comment()
     new_comment.comment = self.cleaned_data["comment"]
     new_comment.email = email 
     new_comment.post = post
     new_comment.activation_code = activation_code
     new_comment.object_id = parent_object.id
     new_comment.content_type = ContentType.objects.get_for_model(parent_object)
     new_comment.is_active = False
     new_comment.save()
     send_comment_activation_mail.delay(activation_code, email)
Ejemplo n.º 4
0
 def save(self):
     parent_object = self.initial["parent_object"]
     email = self.cleaned_data["email"]
     post = self.initial["post"]
     random_int = random.random() * 9999
     activation_code = hashlib.sha224("%s:%s" %
                                      (email, random_int)).hexdigest()[:50]
     print activation_code
     new_comment = Comment()
     new_comment.comment = self.cleaned_data["comment"]
     new_comment.email = email
     new_comment.post = post
     new_comment.activation_code = activation_code
     new_comment.object_id = parent_object.id
     new_comment.content_type = ContentType.objects.get_for_model(
         parent_object)
     new_comment.is_active = False
     new_comment.save()
     send_comment_activation_mail.delay(activation_code, email)