all_news = News.objects.all().order_by('-pk')至
all_news = News.objects.filter(select_news__isnull=True).order_by('-pk')免费咨询:
更改
bestnews1 = Best.objects.filter(select_reason="左一")[0].select_news
至
bestnews1 = Best.objects.filter(select_reason="左一").first()bestnews1_new = None if bestnew1 is None else bestnews1.select_newsreturn render(request, 'index.html', { 'all_news': news, 'bestnews1_new':bestnews1_new, 'bestnews2_new':bestnews2_new, })


