Answers for "if user exist the show her profile or not then they show add profile in django"

0

check if username exists in database django

class FormClass:
	username = ...
	def clean(self):
		super(FormClass, self).clean()
    	username = self.cleaned_data['username']
    	if User.objects.exclude(pk=self.instance.pk).filter(username=username).exists():
        	raise forms.ValidationError(f'Username "{username}" is already in use.')
    	return username
Posted by: Guest on June-07-2021

Code answers related to "if user exist the show her profile or not then they show add profile in django"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language