These are chat archives for django/django

Jan 2016
Jan 22 2016 10:53
is there a way to query model by the instance field of its field? User.foot.left == True, whereas left is instance attribute of the field foot
Jan 22 2016 11:47
@friendOfOurs User.objects.filter(foot__left=True)
Jan 22 2016 12:08
@vadshu not gonna work, left exists only if user is instantiated :/
Filip Figiel
Jan 22 2016 13:26
@friendOfOurs then you have to iterate over users and filter them manually
OR you could actually store that field in the database
do you want to select all users with foot.left? or just a small set?
Jan 22 2016 17:55
@megapctr I extracted it to a separate model since I might need something similiar in future use cases, query is now being done by pk => muuuch better and more elegant :)