title: object is not subscriptable using django and python
body: <p>I am having this error <code>TypeError: 'StudentSubjectGrade' object is not subscriptable</code> of course the data filtered is exist in the database,  and i am sure that the filter is correct. what should i do to correct this ?</p>
  <p><em>note: this is recycle question, please dont mind the comment below,</em></p>
  <pre><code>def SummaryPeriod(request):
      period = request.GET.get('period')
  
      subject = request.GET.get('subject')
      teacher = request.GET.get('teacher')
      print(period, &quot;period&quot;, &quot;subject&quot;, subject)
      cate = gradingCategories.objects.all()
  
      students = StudentSubjectGrade.objects.filter(
          grading_Period=period).filter(
          Subjects=subject).filter(
          Teacher = teacher
      )
  
      print(students)
  
      Categories = list(cate.values_list('id', flat=True).order_by('id'))
  
      table = []
      student_name = None
      table_row = None
      columns = len(Categories) + 1
  
      table_header = ['Student Names']
  
      table_header.extend(list(cate.values('CategoryName', 'PercentageWeight')))
  
      table.append(table_header)
  
      for student in students:
          if not student['Students_Enrollment_Records__Students_Enrollment_Records__Student_Users__Lastname'] + ' ' + \
                 student[
                     'Students_Enrollment_Records__Students_Enrollment_Records__Student_Users__Firstname'] == student_name:
  
              if not table_row is None:
                  table.append(table_row)
  
              table_row = [None for d in range(columns)]
  
              student_name = student[
                                 'Students_Enrollment_Records__Students_Enrollment_Records__Student_Users__Lastname'] + ' ' + \
                             student['Students_Enrollment_Records__Students_Enrollment_Records__Student_Users__Firstname']
              table_row[0] = student_name
  
              id = student['id']
              table_row.append(id)
          table_row[Categories.index(student['Grading_Categories']) + 1] = student['Average'] * student[
              'Grading_Categories__PercentageWeight'] / 100
  
      table.append(table_row)
  
      return render(request, 'Homepage/summaryPeriod.html',
                    {'table': table, &quot;teacher&quot;: teacher, &quot;subject&quot;: subject, &quot;period&quot;: period})
  </code></pre>
  <p>this is my traceback</p>
  <pre><code>Internal Server Error: /SummaryPeriod/
  Traceback (most recent call last):
    File &quot;C:\Users\USER\Desktop\venv\lib\site-packages\django\core\handlers\exception.py&quot;, line 47, in inner
      response = get_response(request)
    File &quot;C:\Users\USER\Desktop\venv\lib\site-packages\django\core\handlers\base.py&quot;, line 179, in _get_response
      response = wrapped_callback(request, *callback_args, **callback_kwargs)
    File &quot;C:\Users\Desktop\Homepage\views.py&quot;, line 2693, in SummaryPeriod
      if not student['Students_Enrollment_Records__Students_Enrollment_Records__Student_Users__Lastname'] + ' ' + \
  TypeError: 'StudentSubjectGrade' object is not subscriptable
  [01/Dec/2020 21:21:01] &quot;GET /SummaryPeriod/?period=3&amp;subject=18&amp;teacher=5 HTTP/1.1&quot; 500 70398
  </code></pre>