Django - AttributeError at / Объект 'tuple' не имеет атрибута 'get'
Я получаю ошибку атрибута в:
Exception Location: C:\Users\user\Desktop\django-basics\env\lib\site-packages\django\middleware\clickjacking.py, line 26, in process_response
Это указанное место (функция process_response):
def process_response(self, request, response):
# Don't set it if it's already in the response
if response.get('X-Frame-Options') is not None:
return response
Мой файл представлений
from django.shortcuts import render
from .models import Student
def studentlist(request):
get_students = Student.objects.all()
data = {
'get_students' : get_students
}
return render(request, 'studentlist.html', data)
Мой файл шаблонов studentlist.html:
{% load static %}
<link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}" />
<title>Student List</title>
</head>
<body>
<div class="container">
<h2 class="text-center mt-5">Student List</h2>
<table class="table table-hover table-dark">
<thead>
<tr>
<th scope="col">Roll No.</th>
<th scope="col">Photo</th>
<th scope="col">Full Name</th>
<th scope="col">Gender</th>
<th scope="col">Course</th>
<th scope="col">Grade in course</th>
</tr>
</thead>
<tbody>
{% for student in get_students %}
<tr>
<td>{{ student.roll_no }}</td>
<td>
<img src="{{ student.photo.url }}" width="40" height="40"/>
</td>
<td>{{ student.full_name }}</td>
<td>{{ student.course }}</td>
<td>{{ student.grade }}</td>
<td>{{ student.gender }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
Пожалуйста, дайте мне знать, если мне нужно добавить больше информации. Заранее спасибо.
если у кого-то такая же проблема, ответ Виллема ван Онсема был тем, который решил мою проблему, у меня была кома в конце.