示例#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
示例#2
0
文件: forms.py 项目: ixth/blombum
 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
示例#3
0
文件: forms.py 项目: exezaid/Dpress
 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
示例#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)
示例#5
0
文件: tests.py 项目: ixth/blombum
 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)
示例#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]) )
示例#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
示例#8
0
文件: views.py 项目: gvidon/blombum
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
示例#9
0
文件: forms.py 项目: exezaid/Dpress
 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