I have a UnitPattern model that references another UnitPatternSet model
eg.
class UnitPattern(db.Model):
unit_pattern_set = db.ReferenceProperty(UnitPatternSet)
in my opinion, I want to display all UnitPattern elements with unit_pattern_set parameters as None, but the request is UnitPattern.all (). filter ("unit_pattern_set =", None) returns nothing, although I have only 5 UnitPatterns, of which 2 are 'unit_pattern_set' and 3 do not have
eg.
print 'Total',UnitPattern.all().count()
print 'ref set',UnitPattern.all().filter("unit_pattern_set !=", None).count()
print 'ref not set',UnitPattern.all().filter("unit_pattern_set =", None).count()
outputs:
Total 5
ref set 2
ref not set 0
Should the sum of queries 2 and 3 be equal to query 1?
It seems that the reason is that I added the reference_pattern_set property later, and these UnitPattern objects existed before that, but how can I filter such objects?
source
share