1👍
✅
Try this:
u = user.objects.filter(username=uname).first()
if not u:
return uname
raise forms.ValidationError('Username not available')
👤nima
0👍
Instead of
u = user.objects.get(username = uname)
It should be :
u = User.objects.get(username = uname)
- How is HttpResponseRedirectBase class being called when I call HttpResponseRedirect
- Nginx conf for Gunicorn on another vm?
- Static files aren't loading after changing STATIC_ROOT and STATICFILES_DIRS in django
Source:stackexchange.com