-1

I am getting this error in one of my django views. What does it mean? How can I solve this? Below is the view where I am getting the error,

def duedate(request):
    data = Task.objects.all()
    total_count = data.count()
    pending_count = 0
    for dat in data:
        if dat.done == False:
            pending_count += 1
    today = datetime.date.today()
    context = {'data':data, 'today':today, 'count':total_count, 'pending':pending_count}
    return render(request, 'todoapp/index.html', context)

Edit1: This is what I'm getting when I 'ipdb' the dictionary

         36     import ipdb; ipdb.set_trace()
         37     context = {'data':data, 'today':today, 'count':total_count, 'pending':pending_count}
    ---> 38     return render(request, 'todoapp/index.html', context)

    ipdb> context                                                                                                                                         
    {'data': <QuerySet [<Task: Finish todo list>, <Task: create views to display due date>]>, 'today': datetime.date(2019, 3, 19), 'count': 2, 'pending': 2}
Mohnish M
  • 113
  • 3
  • 14
  • How to reproduce the issue? Which line is throwing the error? – mad_ Mar 19 '19 at 17:50
  • The last one. The return statement. The dictionary specifically. What's wrong with it? – Mohnish M Mar 19 '19 at 17:52
  • Possible duplicate of [Error: "dictionary update sequence element #0 has length 1; 2 is required" on Django 1.4](https://stackoverflow.com/questions/17610732/error-dictionary-update-sequence-element-0-has-length-1-2-is-required-on-dj) – mad_ Mar 19 '19 at 17:56
  • I added info from ipdb. Does this help? – Mohnish M Mar 19 '19 at 18:08

1 Answers1

0

The problem was in the settings.py file. I'd added a custom templatetag to TEMPLATES. I just had to remove that.

Mohnish M
  • 113
  • 3
  • 14