Я получу записи, кто живет меньше 1 месяца.
cnt = Personne.objects.annotate(
duration=Func(Func(F('deces_an_grg'), F('deces_mois_grg'), F('deces_jour_grg'), function='make_date'), Func(F('date_declaration_an_grg'), F('date_declaration_mois_grg'), F('date_declaration_jour_grg'), function='make_date'), function='age')
).filter(duration__gt=timedelta(days=30)).count()
Но возникает такая ошибка. В чем причина? как я могу это исправить?
int() argument must be a string, a bytes-like object or a number, not 'datetime.timedelta'
Request Method: GET
Request URL: ....
Django Version: 1.10
Exception Type: TypeError
Exception Value:
int() argument must be a string, a bytes-like object or a number, not 'datetime.timedelta'
Exception Location: /***/venv/lib/python3.7/site-packages/django/db/models/fields/__init__.py in get_prep_value, line 1832
Python Executable: /***/venv/bin/python
Python Version: 3.7.1
Python Path:
['***',
'/***/venv/lib/python37.zip',
'/***/venv/lib/python3.7',
'/***/venv/lib/python3.7/lib-dynload',
'/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7',
'/***/venv/lib/python3.7/site-packages']