BK
{{ object_list.first.title }}Size: a a a
BK
{{ object_list.first.title }}BK
mc
{{ object_list.first.category.title }}BK
{{ object_list.first.category.title }}BK
mc
mc
mc
BK
class CategoryArticleListView(ListView):
model = Category
template_name = "categories/category_articles_list.html"
def get_queryset(self):
kwarg_slug = self.kwargs.get("slug")
return CategoryArticle.objects.filter(category__slug=kwarg_slug)
BK
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['title'] = Category.objects.get()
return context
mc
BK
class Category(models.Model):
title = models.CharField(max_length=255)
image = models.ImageField(null=True)
slug = AutoSlugField(populate_from='title')
mc
TB
mc
BK
mc