[Answered ]-Type object 'PizzaMenu' has no attribute '_default_manager'

1👍

Don’t name your view PizzaMenu, it will override the reference to the PizzaMenu for the other views. Usually class-based views have a …View suffix, so:

class IndexView(TemplateView):
    template_name = 'index.html'


# add a View suffix to prevent collissions with the PizzaMenu model class
class PizzaMenuListView(ListView):
    model = PizzaMenu
    template_name = 'menu.html'
    context_object_name = 'pizza_menu'


class PizzaDetailView(DetailView):
    model = PizzaMenu
    template_name = 'pizza_detail.html'
    context_object_name = 'pizza_detail'


class AboutView(TemplateView):
    template_name = 'about.html'

Leave a comment