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
Source:stackexchange.com