Example #1
0
 def save(self, approved=True, user_is_new=False):
     node = CommentNode(user=self.user, object=self.parent, body=self.cleaned_data['body'], approved=approved)
     node.save()
     if appcheck.watchlist and self.cleaned_data.get('subscribe'):
         from watchlist.models import Subscription
         Subscription.objects.subscribe(self.user, node.object)
     return node, user_is_new
Example #2
0
 def save(self, approved=True, user_is_new=False):
     node = CommentNode(user=self.user, object=self.parent, body=self.cleaned_data['body'], approved=approved)
     node.save()
     if appcheck.watchlist and self.cleaned_data.get('subscribe'):
         from watchlist.models import Subscription
         Subscription.objects.subscribe(self.user, node.object)
     return node, user_is_new
Example #3
0
 def save(self, approved=True, user_is_new=False):
     node = CommentNode(user=self.user,
                        object=self.parent,
                        body=self.cleaned_data['body'],
                        approved=approved)
     node.save()
     return node, user_is_new
Example #4
0
 def testDeleteComments(self):
     c = CommentNode(approved=False, body="just test", user=self.user,
                     object=self.p1)
     c.save()
     self.assertEquals(CommentNode.all_objects.count(), 1)
     self.p1.delete()
     self.assertEquals(CommentNode.all_objects.count(), 0)
Example #5
0
 def testDeleteComments(self):
     c = CommentNode(approved=False, body="just test", user=self.user,
                     object=self.p1)
     c.save()
     self.assertEquals(CommentNode.all_objects.count(), 1)
     self.p1.delete()
     self.assertEquals(CommentNode.all_objects.count(), 0)
Example #6
0
def review_metastory(request,metastory_id):
	metastory = get_object_or_404(MetaStory, pk=metastory_id)
	metastory.status = request.POST.get("status",STATUS_DEFAULT)
	metastory.stage = request.POST.get("stage",STAGE_DEFAULT)
	metastory.save()
	
	if request.POST.get("comment",None) != "":
		ctype = ContentType.objects.get_for_model(metastory)
		comment = CommentNode(user=request.user,body=request.POST.get("comment",""),object_id=metastory.id,content_type=ctype)
		comment.save()

	request.user.message_set.create(message="1|MetaStory Status/Comment Saved.")
	return HttpResponseRedirect( reverse('editorsdesk_review_metastory', args=[metastory_id]) )
Example #7
0
def _save_comment(comment_id, new_post, old_post):
    comment = Comment.objects.get(pk=comment_id)
    if not comment.post == old_post:
        raise ValueError("this comment does not belong to this post")
    try:
        user = User.objects.get(email__iexact=comment.author_email)
    except User.DoesNotExist:
        user = ActionRecord.objects.create_user(name=comment.author,
                                                email=comment.author_email,
                                                password=uuid.uuid4().hex[:10],
                                                send_email=False,
                                                site=comment.author_url)
    new = CommentNode(
        user=user,
        pub_date=comment.date,
        body_html=comment.content,
        approved=True,
        object=new_post,
    )
    new.save()
    return new
Example #8
0
def _save_comment(comment_id, new_post, old_post):
    comment = Comment.objects.get(pk=comment_id)
    if not comment.post == old_post:
        raise ValueError("this comment does not belong to this post")
    try:
        user = User.objects.get(email__iexact=comment.author_email)
    except User.DoesNotExist:
        user = ActionRecord.objects.create_user(
            name=comment.author,
            email=comment.author_email,
            password=uuid.uuid4().hex[:10],
            send_email=False,
            site=comment.author_url)
    new = CommentNode(
        user=user,
        pub_date=comment.date,
        body_html=comment.content,
        approved=True,
        object=new_post,
        )
    new.save()
    return new
Example #9
0
 def save(self, approved=True, user_is_new=False):
     node = CommentNode(user=self.user, object=self.parent, body=self.cleaned_data['body'], approved=approved)
     node.save()
     return node, user_is_new