37👍
Here is my case, I am using django shell:
python manage.py shell
There are two models: Topic
and Entry
. I tried to get all entries
from Topic
which id
is 1
.
>>> Topic.objects.get(id=1)
<Topic: Chess>
>>> t = Topic.objects.get(id=1)
>>> t.entry_set().all()
Traceback (most recent call last):
File "<console>", line 1, in <module>
TypeError: __call__() missing 1 required keyword-only argument: 'manager'
>>> t.entry_set.all()
<QuerySet [<Entry: Ah okey, so when testing for a console.log (or oth...>]>
>>>
The correct command is: t.entry_set.all()
, not t.entry_set().all()
Source:stackexchange.com