I am having a validation error when I set a random string in my url as token. How can i catch this validation error?
For example: when accesing: https://www.example.com/stream/8e258b27-c787-49ef-9539-11461b251ffad
The error is ValidationError at /stream/8e258b27-c787-49ef-9539-11461b251ffad ['“8e258b27-c787-49ef-9539-11461b251ffad” is not a valid UUID.']
my code is this:
def stream(request, token):
user = Creador.objects.filter(stream_token=token).first()
if user:
return render(request, 'app1/stream.html', {
'token':token, 'user':user
})
else:
return HttpResponse("Token no existe")
any ideas? thanks