Trying to call Post.objects.filter(category=cats) in my view

im trying to call this method in my view:

def CategoryView(request, cats):
    category_posts = Post.objects.filter(category=cats)
    return render(request, 'categories.html', {'cats': cats, 'category-posts': category_posts})

and i have the category defined in my model, but for some reason the error is create a field called objects in your model. why doesn't it recognize i want to obtain all of the objects in the database?

Back to Top