如何在Django中使用Vue.js?

如何在Django中使用Vue.js?,django,django-models,vuejs2,Django,Django Models,Vuejs2,在Django 2中给出了这个模型 class Question(models.Model): question_text = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') 在我看来 def index(request): latest_question_list = Question.objects.order_by('-pub_date')[:5]

在Django 2中给出了这个模型

class Question(models.Model):
    question_text = models.CharField(max_length=200)
    pub_date = models.DateTimeField('date published')
在我看来

def index(request):
    latest_question_list = Question.objects.order_by('-pub_date')[:5]
    context = {'latest_question_list': latest_question_list}
    return render(request, 'polls/index.html', context)
如何访问index.html中的上下文,以便Vue.js可以使用这些数据

V-for="context in contexts"
${context.fieldname}
Field将是您使用的型号名称,因为您还将拥有所有型号的列表