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 trialKaren Saunders
8,862 PointsDjango ORM - can_spam filter
Can someone please point out where I've made an error in this challenge?
from . import models
def can_spam(request):
spam = models.Review.objects.filter(comment__icontains='http')
spam.delete()
1 Answer
Yosef Fastow
18,526 Points2 things to point out: 1) can_span is not a view so it doesn't need request. 2) also I ended off 'return spam.delete()'. I don't know if that needed but it doesn't hurt to try
def can_spam():
spam = models.Review.objects.filter(comment__icontains='http')
return spam.delete()
Yosef Fastow
18,526 PointsTried out the code both ways. You don't need to add return but request is the problem.
def can_spam():
spam = models.Review.objects.filter(comment__icontains='http')
spam.delete()
Karen Saunders
8,862 PointsKaren Saunders
8,862 PointsIt just say " Bummer! Make sure you delete Reviews that contain any form of "http" in the
comment
field."