File tree Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -153,8 +153,8 @@ def account_result(request):
153
153
if type and type in ['register' , 'validation' ]:
154
154
if type == 'register' :
155
155
content = '''
156
- 恭喜您注册成功,一封验证邮件已经发送到您 {email} 的邮箱 ,请验证您的邮箱后登录本站。
157
- ''' . format ( email = user . email )
156
+ 恭喜您注册成功,一封验证邮件已经发送到您的邮箱 ,请验证您的邮箱后登录本站。
157
+ '''
158
158
title = '注册成功'
159
159
else :
160
160
c_sign = get_sha256 (get_sha256 (settings .SECRET_KEY + str (user .id )))
Original file line number Diff line number Diff line change 4
4
5
5
app_name = "comments"
6
6
urlpatterns = [
7
- # url(r'^po456stcomment/(?P<article_id>\d+)$', views.CommentPostView.as_view(), name='postcomment'),
8
7
path (
9
8
'article/<int:article_id>/postcomment' ,
10
9
views .CommentPostView .as_view (),
Original file line number Diff line number Diff line change 1
1
# Create your views here.
2
+ from django .core .exceptions import ValidationError
2
3
from django .http import HttpResponseRedirect
3
4
from django .utils .decorators import method_decorator
4
5
from django .views .decorators .csrf import csrf_protect
@@ -40,6 +41,8 @@ def form_valid(self, form):
40
41
article_id = self .kwargs ['article_id' ]
41
42
article = Article .objects .get (pk = article_id )
42
43
44
+ if article .comment_status == 'c' or article .status == 'c' :
45
+ raise ValidationError ("该文章评论已关闭." )
43
46
comment = form .save (False )
44
47
comment .article = article
45
48
You can’t perform that action at this time.
0 commit comments