I have a django project that has many different apps. We deleted one
of the apps, and now when we try and delete a user it fails,
complaining about a table from that app not existing. There are no
references to that app, or table anywhere. Testing, I found that if I
create the table the error goes away.

After googling and searching around I thought I had figured it out.
The app was referenced in django_content_type and the content_type_id
was referenced in auth_permission. So I deleted the rows with that
content_type_id from both auth_permission and auth_permission, but I
still get the error. I also made sure the permission rows I deleted
were not referenced in auth_user_user_permissions or
auth_group_permissions.

What do I need to do to remove references to this app so I can delete users?

Here is the full stack trace:

Traceback:
File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py"
in get_response
  115.                         response = callback(request,
*callback_args, **callback_kwargs)
File "/usr/lib/python2.6/site-packages/django/contrib/admin/options.py"
in wrapper
  372.                 return self.admin_site.admin_view(view)(*args, **kwargs)
File "/usr/lib/python2.6/site-packages/django/utils/decorators.py" in
_wrapped_view
  91.                     response = view_func(request, *args, **kwargs)
File "/usr/lib/python2.6/site-packages/django/views/decorators/cache.py"
in _wrapped_view_func
  89.         response = view_func(request, *args, **kwargs)
File "/usr/lib/python2.6/site-packages/django/contrib/admin/sites.py" in inner
  202.             return view(request, *args, **kwargs)
File "/usr/lib/python2.6/site-packages/django/utils/decorators.py" in _wrapper
  25.             return bound_func(*args, **kwargs)
File "/usr/lib/python2.6/site-packages/django/utils/decorators.py" in
_wrapped_view
  91.                     response = view_func(request, *args, **kwargs)
File "/usr/lib/python2.6/site-packages/django/utils/decorators.py" in bound_func
  21.                 return func(self, *args2, **kwargs2)
File "/usr/lib/python2.6/site-packages/django/contrib/admin/options.py"
in changelist_view
  1205.                 response = self.response_action(request,
queryset=cl.get_query_set(request))
File "/usr/lib/python2.6/site-packages/django/contrib/admin/options.py"
in response_action
  960.             response = func(self, request, queryset)
File "/usr/lib/python2.6/site-packages/django/contrib/admin/actions.py"
in delete_selected
  35.         queryset, opts, request.user, modeladmin.admin_site, using)
File "/usr/lib/python2.6/site-packages/django/contrib/admin/util.py"
in get_deleted_objects
  109.     collector.collect(objs)
File "/usr/lib/python2.6/site-packages/django/contrib/admin/util.py" in collect
  160.             return super(NestedObjects, self).collect(objs,
source_attr=source_attr, **kwargs)
File "/usr/lib/python2.6/site-packages/django/db/models/deletion.py" in collect
  225.                 elif sub_objs:
File "/usr/lib/python2.6/site-packages/django/db/models/query.py" in __nonzero__
  141.         return type(self).__bool__(self)
File "/usr/lib/python2.6/site-packages/django/db/models/query.py" in __bool__
  135.             next(iter(self))
File "/usr/lib/python2.6/site-packages/django/db/models/query.py" in
_result_iter
  123.                 self._fill_cache()
File "/usr/lib/python2.6/site-packages/django/db/models/query.py" in _fill_cache
  927.                     self._result_cache.append(next(self._iter))
File "/usr/lib/python2.6/site-packages/django/db/models/query.py" in iterator
  301.         for row in compiler.results_iter():
File "/usr/lib/python2.6/site-packages/django/db/models/sql/compiler.py"
in results_iter
  775.         for rows in self.execute_sql(MULTI):
File "/usr/lib/python2.6/site-packages/django/db/models/sql/compiler.py"
in execute_sql
  840.         cursor.execute(sql, params)
File "/usr/lib/python2.6/site-packages/django/db/backends/util.py" in execute
  41.             return self.cursor.execute(sql, params)
File "/usr/lib/python2.6/site-packages/django/db/backends/mysql/base.py"
in execute
  130.             six.reraise(utils.DatabaseError,
utils.DatabaseError(*tuple(e.args)), sys.exc_info()[2])
File "/usr/lib/python2.6/site-packages/django/db/backends/mysql/base.py"
in execute
  120.             return self.cursor.execute(query, args)
File "/usr/lib64/python2.6/site-packages/MySQLdb/cursors.py" in execute
  173.             self.errorhandler(self, exc, value)
File "/usr/lib64/python2.6/site-packages/MySQLdb/connections.py" in
defaulterrorhandler
  36.     raise errorclass, errorvalue

Exception Type: DatabaseError at /admin/auth/user/
Exception Value: (1146, "Table 'motor.reflection_resource_listeners'
doesn't exist")

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACwCsY7cwB2M7s4Sfse3ecgnCGz2DHoLCsVD-CuY7i4DZisntA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to