티스토리 뷰

공부

[Django] filter query

seunggabi 승가비 2020. 7. 28. 22:20
from myapp.models import Entry
from django.db.models import Q

Entry.objects.filter(~Q(id = 3))

https://stackoverflow.com/questions/687295/how-do-i-do-a-not-equal-in-django-queryset-filtering

 

How do I do a not equal in Django queryset filtering?

In Django model QuerySets, I see that there is a __gt and __lt for comparitive values, but is there a __ne/!=/<> (not equals?) I want to filter out using a not equals: Example: Model: ...

stackoverflow.com

 

'공부' 카테고리의 다른 글

[Linux] install python mysql  (0) 2020.07.28
[Django] not like statement  (0) 2020.07.28
[Django] filter query  (0) 2020.07.28
[jQuery] check loaded image  (0) 2020.07.28
[Python] KafkaConsumer start consuming messages from a timestamp  (0) 2020.07.24
[Presto] function  (0) 2020.07.24
댓글
댓글쓰기 폼