In my Django project I would like to have nullable User's first and last name. Django documentation say that last_name
and first_name
fields are optional. However when I want to insert values to auth_user
table via SQL without first_name
and last_name
I got an error of not-null constraint
INSERT INTO
auth_user(id, password, last_login, is_superuser, username, email, is_staff, is_active, date_joined)
VALUES
(8, 'secret', null, false, 'user5', 'user@one.pl', false, true, current_date);
ERROR: null value in column "first_name" violates not-null constraint
I am using:
- Django 1.10 (upgraded from django 1.9 during project development)
- Postgresql 9.6 (upgraded from pg 9.5 during project development)
django.contrib.auth.User
By django admin site it is possible to create User without providing first_name
and last_name
.
Could you please help me to know why there is such a mismatch and how can I insert via SQL User with empty first and last name?