2👍
✅
Oh, there is serious problems with your views:
First:
class ListView(generic.ListView, slug, id)
should be
class ListView(generic.ListView)
see python inheritance.
Second:
slug
and id
must be class members of your view so you can redefine you view like this:
class ListView(generic.ListView):
template_name = 'entertainment/index.html'
context_object_name = 'latest_article_list'
slug = None
id = None
def get_queryset(self):
return Entertainmentblog.objects.order_by('-posted')[:25]
Third:
Youre naming a derivate class as its parent. I don’t know the implications of doing this, but surely, isn’t a good practice.
Finally:
The error you’re getting is becouse the view returned by views.DetailView.as_view()
(remember DetailView
is your derived class) don’t receives the arguments you are passing through url. Check your url, I can see in the error that is complaining about and argument (u'what-is-happening',)
but there is no id
. It should be something like, for example, (u'what-is-happening', '4')
Source:stackexchange.com