Do an INSERT INTO a User table has been "extended" using django.contrib.auth.models import AbstractUser

Viewed 38

I've cloned a Django/Angular Application and built it. The data migrations produced an empty database. I'm now attempting to set up a way to login as there is no account setup on the login page. The use of the AbstractUser is supposed to require that an email is required in place of a user name.

Trying to find a way to set up the login.

The User model is:

  class User(AbstractUser):
      email = None
      first_name = None
      last_name = None
      REQUIRED_FIELDS = []

      def __str__(self):
          return self.email

      class Meta:
          db_table = 'User'

Table Description is:

                                 Table "public.User"
    Column    |           Type           | Collation | Nullable |              Default               
--------------+--------------------------+-----------+----------+------------------------------------
 id           | integer                  |           | not null | nextval('"User_id_seq"'::regclass)
 password     | character varying(128)   |           | not null | 
 last_login   | timestamp with time zone |           |          | 
 is_superuser | boolean                  |           | not null | 
 username     | character varying(150)   |           | not null | 
 is_staff     | boolean                  |           | not null | 
 is_active    | boolean                  |           | not null | 
 date_joined  | timestamp with time zone |           | not null | 

Using this description I've attempted to some add data to facilitate being able to log in.

select * from "User";
 id |   password   | last_login | is_superuser | username | is_staff | is_active |      date_joined       
----+--------------+------------+--------------+----------+----------+-----------+------------------------
  1 | blankDon012! |            | t            | donfox1  | t        | t         | 2021-11-12 00:00:00-05

Not able to insert an email address. Articles on internet seem to not quite address this issue so far.

0 Answers
Related