Loefbijter / loefsys

MIT License
0 stars 1 forks source link

can't use createsuperuser #9

Closed mark-boute closed 4 months ago

mark-boute commented 5 months ago

python manage.py createsuperuser is broken by "/app/users/managers.py", line 19

Full trace:

Traceback (most recent call last):
  File "/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
psycopg2.errors.NotNullViolation: null value in column "date_joined" of relation "users_user" violates not-null constraint
DETAIL:  Failing row contains (2, argon2$argon2id$v=19$m=102400,t=2,p=8$QnR6WnBDdDdoTGlxWkt3eUxRdX..., null, t, bmark0702@gmail.com, t, t, null).

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 31, in <module>
    execute_from_command_line(sys.argv)
  File "/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/venv/lib/python3.8/site-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/venv/lib/python3.8/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 88, in execute
    return super().execute(*args, **options)
  File "/venv/lib/python3.8/site-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
  File "/venv/lib/python3.8/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 233, in handle
    self.UserModel._default_manager.db_manager(database).create_superuser(
  File "/app/users/managers.py", line 34, in create_superuser
    return self.create_user(email, password, **extra_fields)
  File "/app/users/managers.py", line 19, in create_user
    user.save()
  File "/venv/lib/python3.8/site-packages/django/contrib/auth/base_user.py", line 76, in save
    super().save(*args, **kwargs)
  File "/venv/lib/python3.8/site-packages/django/db/models/base.py", line 814, in save
    self.save_base(
  File "/venv/lib/python3.8/site-packages/django/db/models/base.py", line 877, in save_base
    updated = self._save_table(
  File "/venv/lib/python3.8/site-packages/django/db/models/base.py", line 1020, in _save_table
    results = self._do_insert(
  File "/venv/lib/python3.8/site-packages/django/db/models/base.py", line 1061, in _do_insert
    return manager._insert(
  File "/venv/lib/python3.8/site-packages/django/db/models/manager.py", line 87, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/venv/lib/python3.8/site-packages/django/db/models/query.py", line 1805, in _insert
    return query.get_compiler(using=using).execute_sql(returning_fields)
  File "/venv/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1822, in execute_sql
    cursor.execute(sql, params)
  File "/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
  File "/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/venv/lib/python3.8/site-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
django.db.utils.IntegrityError: null value in column "date_joined" of relation "users_user" violates not-null constraint
DETAIL:  Failing row contains (2, argon2$argon2id$v=19$m=102400,t=2,p=8$QnR6WnBDdDdoTGlxWkt3eUxRdX..., null, t, bmark0702@gmail.com, t, t, null).
mark-boute commented 4 months ago

resolved with #14