[Answer]-Filtering on foreign keys

1👍

You are passing string to the foreign key’s primary key which is integer by default. If you want to filter based on foreign key field use

def get_queryset(self):
    return Article.objects.filter(foreignkey__valuefield=self.kwargs['value'])

Source
https://docs.djangoproject.com/en/dev/topics/db/queries/#filters-can-reference-fields-on-the-model

Leave a comment