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 trialDavid Durst
784 PointsI believe your valdiator is incorrect, I have submitted multiple answers are correct to this question and they all fail.
I believe your validator is incorrect for this answer. This is my 3rd solution, first one is much more compact see below
def article_list(request): return HttpResponse('There are '+len(Article.objects.all())+' articles')
None "CHECK"
from django.http import HttpResponse
from .models import Article
def article_list(request):
articles = Article.objects.all()
output = 'There are '+len(articles)+' articles.'
return HttpResponse(output)
1 Answer
Chris Freeman
Treehouse Moderator 68,441 PointsYou are very close! The len()
function returns an integer. To concatenate it with a string, convert using str()
first:
str(len(articles))