R
R
rm root2020-05-30 18:27:36
Django
rm root, 2020-05-30 18:27:36

Django 3 what filter should be used to get everything where id_parent_id field is not NULL?

comments = ArticleComment.objects.order_by('-id').filter(id_article_id = news.id, id_parent_id = None) # result 5 тут все которые NULL
comments_r = ArticleComment.objects.filter(id_article_id = news.id, id_parent_id = not None) # resul 0 - но должно быть 2 ######## почему не работает ???

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2020-05-30
@rm_root

id_parent_id__isnull=False

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question