[Answer]-Filter iexact error Model matching query does not exist

1👍

Your error is here:

s = Survey.objects.get(name=cod_survey)

you have’t records with name that contains in cod_survey variable…

Add try/except block to catch DoesNotExist exceptions:

try:
    s = Survey.objects.get(name=cod_survey)
except Survey.DoesNotExist:
    s = 'something else...'
👤ndpu

Leave a comment