I am trying to filter users by custom field in each user profile named profile. This field is called the level and is an integer from 0 to 3.
If I filter using equals, I get a list of users with the selected level, as expected:
user_list = User.objects.filter(userprofile__level = 0)
When I try to filter using less:
user_list = User.objects.filter(userprofile__level < 3)
I get an error message:
global name 'userprofile__level' undefined
Does the filter go to <or>, or am I barking the wrong tree.
python django django-queryset
Finglish Apr 6 2018-12-12T00: 00Z
source share