Skip to content Skip to sidebar Skip to footer

Removing An Email From A Django User

When in Django I try the following with a Django user: user.email = None user.save() I get the exception: NOT NULL constraint failed: auth_user.email How does one go about deleti

Solution 1:

In Django, a User is defined as follows:

email = models.EmailField(_('email address'), blank=True)

Consequently, a user's email can be blank (i.e. "") but not null (i.e. None). You clear a user's email with the following:

user.email = ""
user.save()

Post a Comment for "Removing An Email From A Django User"