django / django/new-features

default emil to null instead of empty string in `normalize_email`

Open
#58 7 comments 1 reaction 0 assignees View on GitHub
Dominant language
No language data
Stars
188
Forks
7
PR merge metrics
No merged PRs in 30d

Description

### Code of Conduct

- [x] I agree to follow Django's Code of Conduct

### Feature Description

hi
so as you know [normalize_email](https://github.com/django/django/blob/5a2c1bc07d126ce32efaa157e712a8f3a7457b74/django/contrib/auth/base_user.py#L27) converts falsy emails into an empty string

this is documented and i did this [pr](https://github.com/django/django/pull/19114) on it.

but even now, i do think it'd be much better if it just used `None`

one example of this causing problem, is when you have `unique=True`,
as you know, empty strings are counted when you have `unique=True`, so if one used doesn't provide an email, all other users are forced to provide one, unless we change how users are made manually

### Problem

it'd be good to allow unique values by default

### Request or proposal

request

### Additional Details

_No response_

### Implementation Suggestions

_No response_

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with normalize_email in django/contrib/auth/base_user.py and review the referenced PR #19114. Examine the existing documented behavior and the unique=True example, then determine whether changing falsy emails to None is appropriate and what compatibility implications must be resolved before the proposal is complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
authentication, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.