[Answer]-Filter Django Queryset: ValueError

1๐Ÿ‘

โœ…

If you post your Make model, I can give a complete answer. But in general you are referencing the make foreign key directly โ€“ which is an int (the Make ID). You are comparing this int to the string 'samsung' at make=make causing the error.

Depending on what string fields your Make model has, you need to reference one of those fields. For instance, if Make had a name field that accepted strings:

thing_list = Thing.objects.filter(make__name=make)

Otherwise, you need to pass the make ID instead of 'samsung'

๐Ÿ‘คDan Hoerst

Leave a comment