Django user validation fail just gives 500 Server Error

时间:2017-04-10 03:27:34

标签: python django django-forms django-admin

Let's saying I'm adding a user and I want to fail it for some arbitrary reason.

in signals.py,

def user_presave_handler(sender, instance, **kwargs):
    raise ValidationError('You are a bad person')
pre_save.connect(user_presave_handler, User)

The webpage that the user sees is

(500) Internal Server Error

How do I make that instead notify the user of what went wrong?

Thanks!

0 个答案:

没有答案