我使用django-扁平页面,让管理员从管理员维护/自定义网站的主页。
所以他将能够添加,编辑和删除主页的div内容通过管理员侧。
但请参见以下div的输出。
从管理员端添加的实际内容:
{%if user.is_authenticated %}
<h2>Welcome Back!</h2>
<div class="home-since-last">
<div class="member-photo">
<a href="/person/{{user.username}}"><img src="{{STATIC_URL}}{{user.get_profile.profile_image}}" alt="{{user.username}}" /></a>
</div>
<p><strong>Since your last visit:</strong></p>
<ul>
<li>+{{today_supporter_count}} supporter{{today_supporter_count|pluralize}}</li>
<li>+{{today_comment_count}} comment{{today_comment_count|pluralize}}</li>
<li>+{{today_adoption_count}} adoption{{today_adoption_count|pluralize}}</li>
</ul>
<p><a href="/you">Go to your profile »</a></p>
</div>
{% endif %)输出:
Welcome Back!
{{user.username}}
Since your last visit:
+{{today_supporter_count}} supporter{{today_supporter_count|pluralize}}
+{{today_comment_count}} comment{{today_comment_count|pluralize}}
+{{today_adoption_count}} adoption{{today_adoption_count|pluralize}}
Go to your profile »期望值:
Welcome Back!
bhushan vaiude [Image of user]
Since your last visit:
+12 supporters
+4 comments
+0 adoptions
Go to your profile »作为参考。对于PHP,我想要一些像include('abc.php');这样的东西,这样abc.php文件就可以访问父文件或容器文件的参数。
发布于 2012-12-05 19:20:28
也许您应该看看django-dbtemplates:编写您自己的视图,让管理员从管理员更改模板。
https://stackoverflow.com/questions/13721937
复制相似问题