views.py
class LanguageDetailView(View):
def get_queryset(self):
return Post.objects.filter(to_display=True)
def get(self, request, language_slug=None, slug=None):
if language_slug is not None:
post = self.get_queryset().filter(language__slug=language_slug)
elif slug is not None:
post = self.get_queryset().filter(tags__slug=slug)
else:
post = self.get_queryset()
return render(request, 'blog/language_detail.html', {'post_list': post})
urls.py
urlpatterns = [
path('<slug:language_slug>/', views.LanguageDetailView.as_view(), name='post_list'),
# path('<slug:slug>/', views.TagDetailView.as_view(), name='post_list_tag'),
path('', views.MainView.as_view())
]
language_detail.html
{% for post in post_list %}
<a href="{{ post.slug }}">{{ post.title|title }} </a>
<p>{{ post.description }}</p>
{% endfor %}
Вроде бы все сделал, посты не отображаются(с шаблоном всё норм).
Что надо исправить?