[Fixed]-Django: Generic View not working

1👍

The default name for accessing your model instance is object. So either use {{ object.question_text }} in your template or specify a name in your view class using context_object_name:

class DetailView(generic.DetailView):
    model = Questions
    template_name = 'tolls/detail.html'
    context_object_name = 'question'
👤kaveh

Leave a comment