本文整理汇总了Python中blog.models.Comment.text方法的典型用法代码示例。如果您正苦于以下问题:Python Comment.text方法的具体用法?Python Comment.text怎么用?Python Comment.text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类blog.models.Comment
的用法示例。
在下文中一共展示了Comment.text方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: blog_comment
# 需要导入模块: from blog.models import Comment [as 别名]
# 或者: from blog.models.Comment import text [as 别名]
def blog_comment(request, offset):
offset=int(offset)
e=Entries.objects.filter(id=offset)
if not request.POST['name']:
return HttpResponse(u'이름을 입력하세요')
cmt_name=request.POST['name']
cmt_content=request.POST['content']
if not request.POST['content']:
return HttpResponse(u'글 내용을 입력하세요')
cmt_password=request.POST['password']
if not request.POST['password']:
return HttpResponse(u'비밀번호를 입력하세요')
cmt_password = md5.md5(cmt_password).hexdigest()
cmt=Comment()
try:
cmt.name=cmt_name
cmt.password=cmt_password
cmt.text=cmt_content
ie=Entries.objects.get(id=request.POST['entry_id'])
cmt.entry=ie
ie.cnumber=ie.cnumber+1
ie.save()
cmt.save()
except:
return HttpResponse('오류가 나고 있습니다')
c=Comment.objects.filter(entry=Entries.objects.get(id=offset))
return render_to_response('blog.html',{'offset':offset,'e':e,'c':c})
示例2: comment
# 需要导入模块: from blog.models import Comment [as 别名]
# 或者: from blog.models.Comment import text [as 别名]
def comment(request, article_id):
if not request.POST['author'] or not request.POST['text']:
request.message = "vous avez oubliez une partie du commentaire non?"
return detail(request, article_id)
else:
request.message = "commentaire enregistre!"
comment = Comment()
comment.author=request.POST['author']
comment.text = request.POST['text']
comment.date = timezone.now()
comment.article = Article.objects.get(id = article_id)
comment.save()
return detail(request, article_id)
示例3: post
# 需要导入模块: from blog.models import Comment [as 别名]
# 或者: from blog.models.Comment import text [as 别名]
def post(self,*args,**kwargs):
self.object = self.get_object()
request = self.request
context = self.get_context_data(object=self.object)
comment_f = myforms.CommentForm(self.request.POST)
if comment_f.is_valid():
# (1,2,3).append(5)
comment = Comment()
post_data = comment_f.cleaned_data
comment.text = post_data['text']
comment.reply_to = post_data['reply_to']
comment.email_id = post_data['email_id']
comment.comment_for = self.object
comment.user_name = post_data['user_name']
comment.user_url = post_data['user_url']
comment.user_ip = request.META['REMOTE_ADDR']
comment.user_agent = request.META['HTTP_USER_AGENT']
comment.is_public = getattr(settings, 'AUTO_APPROVE_COMMENTS',
True)
comment.save()
return HttpResponseRedirect('#comment-%s' % comment.pk)
context.update({'comment_form': comment_f})
return self.render_to_response(context)