我的models 没有 objects
AttributeError at /index/
type object 'Artecle' has no attribute 'get'
这是报错信息
from django.db import models class Artecle(models.Model): title = models.CharField(max_length=32,default='title') content = models.TextField(null=True)
这是我的models
from django.shortcuts import render from django.http import HttpResponse from . import models # index or test def index(request): artecle = models.Artecle.objects.get(pk=1) return render(request,"index.html",{"artecle":artecle})
这是我的view