突然需要QuerySet .values()方法位置参数吗?

时间:2018-06-29 17:37:27

标签: django django-queryset

> python manage.py shell
Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from api.models import Listing
>>> Listing.objects.all().values()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
TypeError: values() missing 2 required positional arguments: 'fields' and 'expressions'

Django 2.1 documentation for values() 很清楚地指出“字段”和“表达式”自变量都是可选的,那么有什么用呢?

我的所有模型(甚至是django.contrib.auth.models.User)都存在相同的问题

0 个答案:

没有答案