【发布时间】:2020-04-05 00:34:26
【问题描述】:
'QuerySet' object has no attribute 'year'
Request Method: GET
Request URL: http://127.0.0.1:8000/dashboard/
Django Version: 2.2.8
Exception Type: AttributeError
Exception Value:
'QuerySet' object has no attribute 'year'
models.py
joined_date = models.DateTimeField(default=now, editable=False)
views.py
date_joined = User.objects.order_by('-date_joined')
html
{{ date_joined|timesince }}
【问题讨论】:
-
欢迎来到 SO。请包含代码的相关部分。
标签: django object django-views attributes django-queryset