My IDE (PyCharm) keeps reporting: Function-based generic views have been deprecated.
I have the following statement in my import list:
from django.views.generic.list_detail import object_list
And my view looks like the following:
def category(request, id, slug=None):
category = Category.objects.get(pk=id)
books = Book.objects.filter(
Q(status = 1) & Q(category=category)
).order_by('-id')
s = Poet.objects.order_by('?')[:3]
return object_list(
request,
template_name = 'books/categories/show.html',
queryset = books,
paginate_by = 99,
extra_context = {
'category': category,
'suggestions': s,
'bucket_name': config.BOOKS_BUCKET_NAME,
}
)
I found this in SO, but the docs seems overly complicated in this regard.
Any tips on how I can convert my code would be appreciated.