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

email is not recognized as a variable?

def course_list(request):
    courses = Course.objects.all()
    email = 'question@learingsite.com'
    return render(request, 'courses/course_list.html', {'courses': courses})

and

    <div>
        Have questions? Contact us! {{ email|urlize }}
    </div>

render the text with no link

Could someone please help me out?

1 Answer

Right now the context you're passing to the template only has the courses variable; you'd have to include email in that dictionary for it to be available in your templates also.

return render(request, 'courses/course_list.html', {'courses': courses})

should be

return render(request, 'courses/course_list.html', {'courses': courses, 'email':email})

thank you, it makes sense now!