Browse Source

Signed-off-by: zry <admin@z-touhou.org>

zry 8 years ago
parent
commit
ab473b0e88
2 changed files with 12 additions and 3 deletions
  1. 10 2
      templates/home/post.list.html
  2. 2 1
      views/posts.py

+ 10 - 2
templates/home/post.list.html

@@ -60,7 +60,11 @@
 				<a href="{% url 'pichublog_postlist' j.engname %}"><span class="label label-info" style="display:inline-block">{{j.title}}</span></a>
 			{% endfor %}
 		</p>
-		<blockquote>{% mksummary i.html "233" %}</blockquote>
+		{% if i.private %}
+			<blockquote>{% mksummary i.html "233" %}</blockquote>
+		{% else %}
+			<div class="alert alert-warning" role="alert">这是私密文章,不提供摘要预览。</div>
+		{% endif %}
 	</li>
 	{% endfor %}
 	{% for i in lPage %}
@@ -83,7 +87,11 @@
 				<a href="{% url 'pichublog_postlist' j.engname %}"><span class="label label-info" style="display:inline-block">{{j.title}}</span></a>
 			{% endfor %}
 		</p>
-		<blockquote>{% mksummary i.html "233" %}</blockquote>
+		{% if i.private %}
+			<blockquote>{% mksummary i.html "233" %}</blockquote>
+		{% else %}
+			<div class="alert alert-warning" role="alert">这是私密文章,不提供摘要预览。</div>
+		{% endif %}
 	</li>
 	{% endfor %}
 </ul>

+ 2 - 1
views/posts.py

@@ -170,7 +170,7 @@ def PostView(request,ID):
 				return render_to_response('home/post.err.html',kwvars,RequestContext(request))
 	if bpo.private:
 		if bpo.passwdlck:
-			if request.method == POST:
+			if request.method == "POST":
 				if not request.POST.get['ppppppppaaaaaassssssssssssswwwwwooorrrrrdddd'] == bpo.password:
 					messages.error(request,u"<b>密码错误!</b>")
 					return HttpResponseRedirect(reverse('pichublog_postpwdf',args=(bpo.id,)))
@@ -237,6 +237,7 @@ def PostPreview(request,ID):
 		"bkmode":True,
 	}
 	return render_to_response('home/post.view.html',kwvars,RequestContext(request))
+
 def PostEdit(request,ID):
 	try:
 		bpo = BlogPost.objects.get(id=ID)