Django:'DeleteQuery'对象没有属性'add'

时间:2014-08-09 20:28:08

标签: python mysql django

我在django中有一个用户身份验证表单。一旦我使用超级用户凭据登录表单,我就会遇到此错误:' DeleteQuery'对象没有属性'添加' 我正在使用登录,REDIRECT_FIELD_NAME,django.contrib.auth模块中的注销方法。

这是我的追溯:

File "/home/ramana/enorgo/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  112.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/ramana/enorgo/local/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  52.         response = view_func(request, *args, **kwargs)
File "/home/ramana/enorgo/enorgo/utils/view_functions.py" in wrapper
  23.             output = func(request, *args, **kw)
File "/home/ramana/enorgo/enorgo/apps/base/views.py" in login
  55.             login_user(request, form.get_user())
File "/home/ramana/enorgo/local/lib/python2.7/site-packages/django/contrib/auth/__init__.py" in login
  83.         request.session.cycle_key()
File "/home/ramana/enorgo/local/lib/python2.7/site-packages/django/contrib/sessions/backends/base.py" in cycle_key
  279.         self.delete(key)
File "/home/ramana/enorgo/local/lib/python2.7/site-packages/django/contrib/sessions/backends/db.py" in delete
  75.             Session.objects.get(session_key=session_key).delete()
File "/home/ramana/enorgo/local/lib/python2.7/site-packages/django/db/models/base.py" in delete
  695.         collector.delete()
File "/home/ramana/enorgo/local/lib/python2.7/site-packages/django/db/models/deletion.py" in delete
  277.                 query.delete_batch(pk_list, self.using)
File "/home/ramana/enorgo/local/lib/python2.7/site-packages/django/db/models/sql/subqueries.py" in delete_batch
  47.             where.add((Constraint(None, field.column, field), 'in',

Exception Type: AttributeError at /login/
Exception Value: 'DeleteQuery' object has no attribute 'add'

1 个答案:

答案 0 :(得分:0)

实际上,当我转移到另一个数据库时,这个问题就解决了。如果有人能解释为什么会这样,那就太好了。