Advertisement
Darkolius

Untitled

Dec 12th, 2020
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. from django.utils.translation import gettext_lazy as _
  2.  
  3. from django.contrib.auth.models import User
  4. from django.contrib.auth.validators import UnicodeUsernameValidator
  5.  
  6.  
  7. class MyUnicodeUsernameValidator(UnicodeUsernameValidator):
  8.     print('test My')
  9.     regex = r'^[\d]'
  10.     message = _(
  11.         'Enter a valid username. This value may contain only letters, '
  12.         'numbers, and @/./+/-/_ characters.'
  13.     )
  14.     flags = 0
  15.  
  16.  
  17. class User2(User):
  18.     username_validator = MyUnicodeUsernameValidator()
  19.     print(username_validator)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement