Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

100
Views
Django ValueError The view todo_lists.views.visualisation didn't return an HttpResponse object. It returned None instead

everyone. I have views.py here, I want to calculate different status' tasks and output to chart.js pie-chart. I have tried many ways but none of them works. I have an error saying my views def didn't return HttpResponse, can anyone tell me what it is, please? I used template tags in HTML.

Thanks.

views.py

def visualisation(request, project_id):

    project = Project.objects.get(id=project_id)

    counts_data = Todo.objects.annotate(
        to_do_count = Count('id', filter=Q(status='to_do')),
        in_progress_count = Count('id', filter=Q(status='in_progress')),
        done_count = Count('id', filter=Q(status='done'))
        ).order_by('-to_do_count')

    context = {'counts_data', counts_data}
    return render(request, 'todo_lists/progress.html', context)

html

    data: {
        labels: [1,2,3],
        
        datasets: [{
            label: '# of Votes',

            data:[{% for todo in counts_data %} {{ todo }}, {% endfor %}],,
            
            backgroundColor: [
                'rgba(255, 99, 132, 0.2)',
                'rgba(54, 162, 235, 0.2)',
                'rgba(255, 206, 86, 0.2)'
            ],
            borderColor: [
                'rgba(255, 99, 132, 1)',
                'rgba(54, 162, 235, 1)',
                'rgba(255, 206, 86, 1)'
            ],
            borderWidth: 1
        }]
    },
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

There is a def function that has the same name and did not have return sentence, delete it and the issue is gone. @sintribu cheers

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!