导入错误无法导入ProductsListView

时间:2019-07-09 04:45:26

标签: django-views

在我的终端上说从django.views导入ProductsListView,product_list_view导入错误:无法从django.views导入名称“ ProductsListView”

我几乎尝试了一切

from django.views.generic.list import ListView
from django.shortcuts import render

from .models import Products

class ProductsListView(ListView):
    queryset = Product.objects.all()
    template_name = "products/list.html"


def product_list_view(request):
    queryset = Product.object.all()
    context = {
        'object_list': queryset
    }
    return render(request, "products/product_list_.html", context)

0 个答案:

没有答案