In my django app I have a custom user model with a username field called my_username
. Recently I made this field non unique (actually it is now unique_together
with another field). This makes django to emit the following warning in manage.py
:
(auth.W004) 'MyUser.my_username' is named as the 'USERNAME_FIELD', but it is not unique. HINT: Ensure that your authentication backend(s) can handle non-unique usernames.
Is there a way to prevent this warning for displaying? I only found ways to disable all warnings, but I want to disable only that specific one.
Since Django 1.7, there is a setting to silence certain warnings. If you are using Django 1.7 or later, you can add the error code to the SILENCED_SYSTEM_CHECKS
setting:
# settings.py
SILENCED_SYSTEM_CHECKS = ["auth.W004"]
source: https://docs.djangoproject.com/en/dev/ref/settings/#silenced-system-checks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With