Opened 10 years ago

Last modified 10 years ago

#23297 closed Uncategorized

Integrity error saving Site with custom User model — at Initial Version

Reported by: Dustin Farris Owned by: nobody
Component: contrib.auth Version: 1.7-rc-2
Severity: Release blocker Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I use a custom User model: accounts.User

When trying to update an entry for a django.Site record in the Django admin:

IntegrityError: insert or update on table "django_admin_log" violates foreign key constraint "django_admin_log_user_id_41e5d33e37dd3226_fk_auth_user_id"
DETAIL:  Key (user_id)=(4) is not present in table "auth_user".
Stacktrace (most recent call last):

  File "django/core/handlers/base.py", line 111, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "django/contrib/admin/options.py", line 546, in wrapper
    return self.admin_site.admin_view(view)(*args, **kwargs)
  File "django/utils/decorators.py", line 105, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "django/views/decorators/cache.py", line 52, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "django/contrib/admin/sites.py", line 204, in inner
    return view(request, *args, **kwargs)
  File "django/contrib/admin/options.py", line 1416, in change_view
    return self.changeform_view(request, object_id, form_url, extra_context)
  File "django/utils/decorators.py", line 29, in _wrapper
    return bound_func(*args, **kwargs)
  File "django/utils/decorators.py", line 105, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "django/utils/decorators.py", line 25, in bound_func
    return func.__get__(self, type(self))(*args2, **kwargs2)
  File "django/db/transaction.py", line 394, in inner
    return func(*args, **kwargs)
  File "django/db/transaction.py", line 339, in __exit__
    connection.commit()
  File "django/db/backends/__init__.py", line 176, in commit
    self._commit()
  File "django/db/backends/__init__.py", line 145, in _commit
    return self.connection.commit()
  File "django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "django/utils/six.py", line 549, in reraise
    raise value.with_traceback(tb)
  File "django/db/backends/__init__.py", line 145, in _commit
    return self.connection.commit()

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top