[Fixed]-Auth_User – Leaving the Username field Blank

1👍

Django User(contrib.auth.models.User) model extend AbstractUser which has username field defined as

username = models.CharField(_('username'), max_length=30, unique=True,
    help_text=_('Required. 30 characters or fewer. Letters, numbers and '
                '@/./+/-/_ characters'),
    validators=[
        validators.RegexValidator(re.compile('^[\w.@+-]+$'), _('Enter a valid username.'), 'invalid')
    ])

so if you need username field blank then you need to write custom user model. The instruction for this can be found at Customizing authentication in Django-A full example

Leave a comment