I read this : https://stackoverflow.com/a/17090205/6426449
And I made a list that cannot be used on username in django.
list : FORBIDDEN_USERNAME_LIST = ['admin', 'master', 'owner']
So I made a code like this :
views.py
def username_choice(request):
if request.method == "POST":
username = request.POST['username']
for item in forbidden.FORBIDDEN_USERNAME_LIST:
match = re.search("r'\b"+item+"\b'", username)
if match:
return JsonResponse({'result': item + 'banned username'})
But It seems that it does not work.
Maybe I think, match = re.search("r'\b"+item+"\b'", username)
Here is problem.
How can I fix that?