Issue #142 new

'BaseUser' object has no attribute 'username'

Юрий Макаров
created an issue

We are running custom model of BaseUser, so we don't have username field. Sometimes it breaks while deleting BaseUser objects (sometimes no). Installed version of admin tools is 0.5.1 and Django version is 1.5.2. There is full trace

Traceback (most recent call last):

  File "/home/www/sites/jsp/jsp/myenv/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 115, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/home/www/sites/jsp/jsp/myenv/local/lib/python2.7/site-packages/django/contrib/admin/options.py", line 372, in wrapper
    return self.admin_site.admin_view(view)(*args, **kwargs)

  File "/home/www/sites/jsp/jsp/myenv/local/lib/python2.7/site-packages/django/utils/decorators.py", line 91, in _wrapped_view
    response = view_func(request, *args, **kwargs)

  File "/home/www/sites/jsp/jsp/myenv/local/lib/python2.7/site-packages/django/views/decorators/cache.py", line 89, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)

  File "/home/www/sites/jsp/jsp/myenv/local/lib/python2.7/site-packages/django/contrib/admin/sites.py", line 202, in inner
    return view(request, *args, **kwargs)

  File "/home/www/sites/jsp/jsp/myenv/local/lib/python2.7/site-packages/django/utils/decorators.py", line 25, in _wrapper
    return bound_func(*args, **kwargs)

  File "/home/www/sites/jsp/jsp/myenv/local/lib/python2.7/site-packages/django/utils/decorators.py", line 91, in _wrapped_view
    response = view_func(request, *args, **kwargs)

  File "/home/www/sites/jsp/jsp/myenv/local/lib/python2.7/site-packages/django/utils/decorators.py", line 21, in bound_func
    return func(self, *args2, **kwargs2)

  File "/home/www/sites/jsp/jsp/myenv/local/lib/python2.7/site-packages/django/db/transaction.py", line 223, in inner
    return func(*args, **kwargs)

  File "/home/www/sites/jsp/jsp/myenv/local/lib/python2.7/site-packages/django/contrib/admin/options.py", line 1326, in delete_view
    [obj], opts, request.user, self.admin_site, using)

  File "/home/www/sites/jsp/jsp/myenv/local/lib/python2.7/site-packages/django/contrib/admin/util.py", line 137, in get_deleted_objects
    to_delete = collector.nested(format_callback)

  File "/home/www/sites/jsp/jsp/myenv/local/lib/python2.7/site-packages/django/contrib/admin/util.py", line 191, in nested
    roots.extend(self._nested(root, seen, format_callback))

  File "/home/www/sites/jsp/jsp/myenv/local/lib/python2.7/site-packages/django/contrib/admin/util.py", line 174, in _nested
    children.extend(self._nested(child, seen, format_callback))

  File "/home/www/sites/jsp/jsp/myenv/local/lib/python2.7/site-packages/django/contrib/admin/util.py", line 176, in _nested
    ret = [format_callback(obj)]

  File "/home/www/sites/jsp/jsp/myenv/local/lib/python2.7/site-packages/django/contrib/admin/util.py", line 135, in format_callback
    force_text(obj))

  File "/home/www/sites/jsp/jsp/myenv/local/lib/python2.7/site-packages/django/utils/encoding.py", line 99, in force_text
    s = s.__unicode__()

  File "/home/www/sites/jsp/jsp/myenv/local/lib/python2.7/site-packages/admin_tools/dashboard/models.py", line 19, in __unicode__
    return "%s dashboard preferences" % self.user.username

AttributeError: 'BaseUser' object has no attribute 'username'
<WSGIRequest
path:/admin/users/baseuser/10123/delete/,
GET:<QueryDict: {}>,
POST:<QueryDict: {}>,

Comments (0)

  1. Log in to comment