Skip to content Skip to sidebar Skip to footer

In Python Django I Want To Execute Two Statements On If Else That If Email Is Taken Show Message If Employee Id Is Taken Show Message

I have a html registration form where I am displaying if any username or email exists or not so if it exists then display username is taken and if email exists it will display ema

Solution 1:

Since django already sets unique to username so likewise you can set email to be unique in model itself.

User._meta.get_field('email')._unique = True

Then you can create a form and check if its valid and if there's duplicate entry for username or email it will show that its already taken.


Post a Comment for "In Python Django I Want To Execute Two Statements On If Else That If Email Is Taken Show Message If Employee Id Is Taken Show Message"