Переменная шаблона Django не найдена
Я довольно новичок в Django и я действительно борюсь с этой проблемой. Так что если кто-то может помочь, я буду очень благодарен :). В основном, каждый раз, когда я обращаюсь к пути, чтобы добраться до одного конкретного профиля, переменная {{profile.user.username|default="Not found"}} не распознается и выводится значение по умолчанию. Когда я обращаюсь к другому пути, например profile_list, из той же переменной выводится правильное значение. Обе html-страницы (profile.html и profile_list.html) наследуются от base.html. Есть идеи, где может быть проблема или куда мне следует обратиться?
profile.html
{% extends 'base.html' %}
{% block content %}
<div class="column">
<div class="block">
<h1 class="title is-1">
{{profile.user.username|default:"Not found"}}
</h1>
</div>
</div>
{%endblock content%}
profile_list.html
{% extends 'base.html' %}
{% block content %}
<div class="column">
{% for profile in profiles %}
<div class="block">
<div class="card">
<a href="#">
<div class="card-content">
<div class="media">
<div class="media-left">
<figure class="image is-48x48">
<img src="https://bulma.io/images/placeholders/96x96.png"
alt="Placeholder image">
</figure>
</div>
<div class="media-content">
<p class="title is-4">
{{ profile.user.username }}
</p>
<p class="subtitle is-6">
@{{ profile.user.username|lower }}
</p>
</div>
</div>
</div>
</a>
</div>
</div>
{% endfor %}
</div>
{% endblock content %}
views.py
from django.shortcuts import render
from .models import Profile
# Create your views here.
def dashboard(request):
return render(request, 'base.html')
def profile_list(request):
profile = Profile.objects.exclude(user=request.user)
return render(request, 'myapp/profile_list.html', {'profiles':profiles})
def profile(request, pk):
profile = Profile.objects.get(pk=pk),
return render(request, 'myapp/profile.html', {'profile':profile})