列表显示不出来的问题
from django.db import models # Create your models here. class Article(models.Model): title = models.CharField(max_length=32,default='title') content = models.TextField(null = True) def __str__(self): return self.title
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
from . import models
def index(request):
articles = models.Article.objects.all()
return render(request, 'index.html', {'articles': articles})<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h1>
<a href="">新文章</a>
</h1>
{% for aritcle in articles %}
<a href="">{{ article.title }}</a>
<br/>
{% endfor %}
</body>
</html>如果不用all 用get就能显示出一条信息,求问各位