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 trialSultan Abdullah
Full Stack JavaScript Techdegree Student 9,985 Pointscreating a view with Django, "Didn't get the right output" ? [Solved]
The question asks to make a Django view that returns a string that contians the number of articles like this "There are 5 articles.". But I keep getting "Bummer! Didnt get the right output" . I checked the code over and revised the video, can't seem to find what's wrong.
Also the challenge doesn't wanna show me the output it got so it's even harder to debug xD
Here's my code:
from django.http import HttpResponse
from .models import Article
# Write your views here
def article_list(response):
articles = Article.object.all()
st = 'There are {} articles.'.format(len(articles))
return HttpResponse(st)
Sultan Abdullah
Full Stack JavaScript Techdegree Student 9,985 PointsSultan Abdullah
Full Stack JavaScript Techdegree Student 9,985 PointsTHERE IT IS!!
Alright I've resolved the problem. I had a typo, it should be:
articles = Article.objects.all()
not
articles = Article.object.all()
it's "objects" not "object" (there is an "s"). classic xD