3

Im trying to get a bio info for each profile, when running server and going to accounts/profile y find this error:

Could not parse some characters: |% with website=profile.website| | default:"" %

{% extends 'base.html' %}

{% block title %}Profile{% endblock %}

{% block content %}

<h1>
    {{ user.get_null_name }} (@{{ user.username }})
</h1>
 
{% with profile=user.profile %}
    {% if profile %}
        <h2>
            {{ profile.persona }}  
        </h2>
        <div> 
            {{ profile.bio|default:"" }}
        </div>
        <div>
            {{ % with website=profile.website | default:"" % }}
                <a href="{{website}}">{{website}} </a>
            {% endwith %}
        </div>
        <br/>
        <div>
            Interest:
            {% for Interest in profile.interest.all %}
                <span>
                    {{ interest.name }}{% if not forloop.last %}, {% endif %}
                </span>
            {% endfor %}
        </div>
    {% endif %}
{% endwith %}


{% endblock %}
ihincapie
  • 65
  • 1
  • 6

1 Answers1

2

A template tag does not use double curly brackets ({{ … }}), but single ones, with the % immediately followed by that (so {% … %}). The {% with … %} block in your template uses double curly brackets:

{% with website=profile.website|default:'' %}
    …
{% endwith %}
Willem Van Onsem
  • 443,496
  • 30
  • 428
  • 555