[Answer]-How to pass in the fieldname to filter in django?

1👍

kwargs = {"%s__startswith" % (request.GET['fieldname']) : request.GET['query']}
Entry.objects.filter(**kwargs)
👤JamesO

Leave a comment