from django.shortcuts import render
from django.views import View
from .utils import get_categories
from .models import ContentCategory


class IndexView(View):
    def get(self, request):

        # 广告数据
        contents = {}
        content_categories = ContentCategory.objects.all()
        for category in content_categories:
            contents[category.key] = category.content_set.filter(status=True).order_by('sequence')

        # 查询商品频道和分类
        categories = get_categories()
        context = {
            'categories': categories,
            'contents': contents
        }
        return render(request, 'index.html', context)

ae509c5e88ae8dcf2b7831930f87c345867d5119
<mask token>

<mask token>


class IndexView(View):
    <mask token>

<mask token>


class IndexView(View):

    def get(self, request):
        contents = {}
        content_categories = ContentCategory.objects.all()
        for category in content_categories:
            contents[category.key] = category.content_set.filter(status=True
                ).order_by('sequence')
        categories = get_categories()
        context = {'categories': categories, 'contents': contents}
        return render(request, 'index.html', context)

from django.shortcuts import render
from django.views import View
from .utils import get_categories
from .models import ContentCategory


class IndexView(View):

    def get(self, request):
        contents = {}
        content_categories = ContentCategory.objects.all()
        for category in content_categories:
            contents[category.key] = category.content_set.filter(status=True
                ).order_by('sequence')
        categories = get_categories()
        context = {'categories': categories, 'contents': contents}
        return render(request, 'index.html', context)

from django.shortcuts import render
from django.views import View
from .utils import get_categories
from .models import ContentCategory


class IndexView(View):
    def get(self, request):

        # 广告数据
        contents = {}
        content_categories = ContentCategory.objects.all()
        for category in content_categories:
            contents[category.key] = category.content_set.filter(status=True).order_by('sequence')

        # 查询商品频道和分类
        categories = get_categories()
        context = {
            'categories': categories,
            'contents': contents
        }
        return render(request, 'index.html', context)
