bhushya
bhushya

Reputation: 1317

Not able to use {{ variable }} in django-flatpages

I am using django-flatpages to allow admin to maintain / customize homepage of website from admin.

So he will able to add, edit & delete homepage div content through admin side.

But see output for following div.

Actual content added from admin side:

{%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 %)

Output :

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 »

Expected:

Welcome Back!
bhushan vaiude [Image of user]

Since your last visit:

    +12 supporters
    +4 comments
    +0 adoptions

Go to your profile »

As ref. to PHP, I want some thing like include('abc.php'); so abc.php file can access parameters of parent or container files.

Upvotes: 1

Views: 145

Answers (1)

vad
vad

Reputation: 1266

Probably you should look at django-dbtemplates: write your own view and let the admin change the template from the admin.

Upvotes: 1

Related Questions