首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在django-flatpages中使用{{ variable }}

无法在django-flatpages中使用{{ variable }}
EN

Stack Overflow用户
提问于 2012-12-05 19:10:12
回答 1查看 128关注 0票数 1

我使用django-扁平页面,让管理员从管理员维护/自定义网站的主页。

所以他将能够添加,编辑和删除主页的div内容通过管理员侧。

但请参见以下div的输出。

从管理员端添加的实际内容:

代码语言:javascript
复制
{%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 &raquo;</a></p>
</div>
{% endif %)

输出:

代码语言:javascript
复制
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 »

期望值:

代码语言:javascript
复制
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文件就可以访问父文件或容器文件的参数。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-12-05 19:20:28

也许您应该看看django-dbtemplates:编写您自己的视图,让管理员从管理员更改模板。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13721937

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档