Django对象没有属性获取错误

时间:2020-09-22 11:35:25

标签: django django-models django-forms django-views

我有此错误,原因是什么? get error是什么意思,此任务的解决方案是什么? AttributeError:“ Aries”对象没有属性“ get” [22 / Sep / 2020 11:30:51]“ GET / aries HTTP / 1.1” 500 65607

Views.py

def Zodiac(request):
    forms = Aries.objects.all()
    args = {'forms':forms}

    return render(request,'html/aries.html',args)

html 每天

<div class="period_date">
                        {% block text %}
                        {% for date in forms  %}
                        {%if forloop.last%}
                        Published on {{date.pub_date}}
                        {% endif %}
                        {% endfor %}</div>
                        {% endblock text %}

model.py

class Aries(models.Model):
    pub_date = models.DateField()
    body_text = models.TextField()
    love_text = models.TextField(null=True)

0 个答案:

没有答案