Zanazanyan display articles in a certain category?

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', {'our post_list': post})


urls.py
mapping includes = [
 path('<slug:language_slug>/', views.LanguageDetailView.as_view(), name='our post_list'),
 # path('<slug:slug>/', views.TagDetailView.as_view(), name='post_list_tag'),
 path ("views.MainView.as_view())
]


language_detail.html
{% for post in our post_list %}
 <a href="{{ post.slug }}">{{ post.title|title }} </a>
 <p>{{ post.description }}</p>
 {% endfor %}


Everything seems to be done, posts not showing(template of all the rules).
What must I do?
April 19th 20 at 12:27
1 answer
April 19th 20 at 12:29
Debajit learn better than to repeat the questions. At least put print(post) return render before to understand that post, or mistake in front of him what do you Django will display a bunch of information.
PS why use a View when ListView is?
I think that ListView, DetailView and so not very convenient - Rebeca_Schamberg commented on April 19th 20 at 12:32
@Rebeca_Schamberg, yeah, you think it is - Hosea.Mante36 commented on April 19th 20 at 12:35
@Hosea.Mante36 wrote print what you said and I have an empty queryset - Rebeca_Schamberg commented on April 19th 20 at 12:38
@Rebeca_Schamberg, well versed on why blank me to tell you every place where you can put print? - Hosea.Mante36 commented on April 19th 20 at 12:41
@Hosea.Mante36, no, but the trick is that if there is no filter, the posts there. How then do I create a filter? - Rebeca_Schamberg commented on April 19th 20 at 12:44
@Rebeca_Schamberg, well, think a bit, so you filter out all of the posts, i.e. you have no posts with the specified slug you - Hosea.Mante36 commented on April 19th 20 at 12:47

Find more questions by tags Django