2

大家好,有一个错误让我很困惑......谁能告诉我这个错误的原因是什么以及如何处理它......

DatabaseError at /admin/auth/user/

column salarylive_userprofile.firstname does not exist
LINE 1: ...."username_id", "salarylive_userprofile"."email", "salaryliv...
                                                             ^

Request Method:     POST
Request URL:    http://localhost:8000/admin/auth/user/
Django Version:     1.4.3
Exception Type:     DatabaseError
Exception Value:    

column salarylive_userprofile.firstname does not exist
LINE 1: ...."username_id", "salarylive_userprofile"."email", "salaryliv...
                                                             ^

Exception Location:     c:\Python27\lib\site-packages\django\db\backends\postgresql_psycopg2\base.py in execute, line 52
Python Executable:  c:\Python27\python.exe
Python Version:     2.7.0
Python Path:    

['e:\\Software Installations\\Aptana Workspace\\salary',
 'C:\\Windows\\SYSTEM32\\python27.zip',
 'c:\\Python27\\DLLs',
 'c:\\Python27\\lib',
 'c:\\Python27\\lib\\plat-win',
 'c:\\Python27\\lib\\lib-tk',
 'c:\\Python27',
 'c:\\Python27\\lib\\site-packages']

Server time:    Fri, 1 Mar 2013 10:26:31 +0530

和追溯是: -

Environment:


Request Method: POST
Request URL: http://localhost:8000/admin/auth/user/

Django Version: 1.4.3
Python Version: 2.7.0
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'salarylive')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "c:\Python27\lib\site-packages\django\core\handlers\base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "c:\Python27\lib\site-packages\django\contrib\admin\options.py" in wrapper
  366.                 return self.admin_site.admin_view(view)(*args, **kwargs)
File "c:\Python27\lib\site-packages\django\utils\decorators.py" in _wrapped_view
  91.                     response = view_func(request, *args, **kwargs)
File "c:\Python27\lib\site-packages\django\views\decorators\cache.py" in _wrapped_view_func
  89.         response = view_func(request, *args, **kwargs)
File "c:\Python27\lib\site-packages\django\contrib\admin\sites.py" in inner
  196.             return view(request, *args, **kwargs)
File "c:\Python27\lib\site-packages\django\utils\decorators.py" in _wrapper
  25.             return bound_func(*args, **kwargs)
File "c:\Python27\lib\site-packages\django\utils\decorators.py" in _wrapped_view
  91.                     response = view_func(request, *args, **kwargs)
File "c:\Python27\lib\site-packages\django\utils\decorators.py" in bound_func
  21.                 return func(self, *args2, **kwargs2)
File "c:\Python27\lib\site-packages\django\contrib\admin\options.py" in changelist_view
  1153.                 response = self.response_action(request, queryset=cl.get_query_set(request))
File "c:\Python27\lib\site-packages\django\contrib\admin\options.py" in response_action
  908.             response = func(self, request, queryset)
File "c:\Python27\lib\site-packages\django\contrib\admin\actions.py" in delete_selected
  35.         queryset, opts, request.user, modeladmin.admin_site, using)
File "c:\Python27\lib\site-packages\django\contrib\admin\util.py" in get_deleted_objects
  104.     collector.collect(objs)
File "c:\Python27\lib\site-packages\django\contrib\admin\util.py" in collect
  155.             return super(NestedObjects, self).collect(objs, source_attr=source_attr, **kwargs)
File "c:\Python27\lib\site-packages\django\db\models\deletion.py" in collect
  175.                     if not sub_objs:
File "c:\Python27\lib\site-packages\django\db\models\query.py" in __nonzero__
  130.             iter(self).next()
File "c:\Python27\lib\site-packages\django\db\models\query.py" in _result_iter
  118.                 self._fill_cache()
File "c:\Python27\lib\site-packages\django\db\models\query.py" in _fill_cache
  892.                     self._result_cache.append(self._iter.next())
File "c:\Python27\lib\site-packages\django\db\models\query.py" in iterator
  291.         for row in compiler.results_iter():
File "c:\Python27\lib\site-packages\django\db\models\sql\compiler.py" in results_iter
  763.         for rows in self.execute_sql(MULTI):
File "c:\Python27\lib\site-packages\django\db\models\sql\compiler.py" in execute_sql
  818.         cursor.execute(sql, params)
File "c:\Python27\lib\site-packages\django\db\backends\util.py" in execute
  40.             return self.cursor.execute(sql, params)
File "c:\Python27\lib\site-packages\django\db\backends\postgresql_psycopg2\base.py" in execute
  52.             return self.cursor.execute(query, args)

Exception Type: DatabaseError at /admin/auth/user/
Exception Value: column salarylive_userprofile.firstname does not exist
LINE 1: ...."username_id", "salarylive_userprofile"."email", "salaryliv...
                                                             ^

我应该如何处理这个问题..........................代码图像是这样的: - 在此处输入图像描述 在此处输入图像描述 在此处输入图像描述 在此处输入图像描述 在此处输入图像描述 在此处输入图像描述

4

1 回答 1

0

我认为您的查询中缺少“_”,不应该salarylive__userprofile代替salarylive_userprofile吗?

于 2013-03-15T11:32:38.513 回答