Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

Andrew Feather
PLUS
Andrew Feather
Courses Plus Student 6,572 Points

cannot convert dictionary update sequence element #0

I'm working on a local machine, and I had this error pop up.

"cannot convert dictionary update sequence element #0" & I wasn't getting the course detail output.

It took a few minutes of digging, but changing course to a context appears to have worked. There are instructions here: http://stackoverflow.com/questions/31105131/django-cannot-convert-dictionary-update-sequence-element-0-to-a-sequence

2 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,441 Points

There is also a shortcut version where you can add any item to the context directly as an argument to render

I've added this answer to the StackOverflow question you referenced.

In addition to explicitly creating a context as done by @Bogey Jammer, you can add the contacts to the context by specifying it in a dict as an argument to render:

def all_contacts(request):
    contacts = Contact.objects.all()
    return render(request, 'about/all.html', 
                  {'contacts': contacts})