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 trialAlexander Birch
1,804 PointsIn the recent_reviews view, use datetime.datetime.today() and a datetime.timedelta to get a new datetime of 180 days ago
So im a little confused by this, I have looked it up and people are talking about a __lt and __gt filter, is that what should be used in this case? It seems like a bit of a jump to this filter...
from django.shortcuts import render
import datetime import timedelta
from . import models
def good_reviews(request):
reviews = models.Review.objects.filter(rating__gte=3)
return render(request, 'products/reviews.html', {'reviews': reviews})
def recent_reviews(request):
now = datetime.datetime.today()
past = datetime.timedelta(days=180)
return render(request, 'products/reviews.html', {'reviews': None})
Bernardo Augusto García Loaiza
Courses Plus Student 792 PointsBernardo Augusto García Loaiza
Courses Plus Student 792 Points@alexanderbirch I saw this question post a bit late, I think so that you have solve this case ... ? Of anyway, in this challenge, is necessary use the __lte filter (less than)
I've solved of this way
Here another ways to do it in the shell
Of in one instruction