Home > other > Django about Q in the use of the emergence of a bug, thank hope leaders can help me solve the us
Django about Q in the use of the emergence of a bug, thank hope leaders can help me solve the us
Time:09-19
The from the django. Db import models
# the Create your models here.
The class Project (models. Model) : Project=models. CharField (max_length=128)
The class Change (models. Model) : Project=models. ForeignKey (project, on_delete=models. The CASCADE) Se=models. CharField (max_length=128, null=True) The date=models. DateTimeField ()
- this is a model class
[92] : In the Project. The objects. The filter (Q (change__date__date__range=[' 2020-04-28 ', '2020-04-28']), ~ Q (change__se__isnull=True)). The count () The Out [92] : 8
In [93] :
[93] : In the Project. The objects. The filter (Q (change__date__date__range=[' 2020-04-28 ', '2020-04-28']), Q (change__se__isnull=False)). The count () 9 Out [93] :
- this is my query - I don't know why the result is different 9 is right - I really need help It would be appreciated if -