昨天一切都工作正常,今天我进入管理员,当我点击" usuarios_aux"时出现此错误模型...
Unable to lookup 'u' on Usuario_aux or Usuario_AuxAdmin
为什么会这样?继续追溯。
环境:
请求方法:GET请求URL: http://provisional.jetint.webfactional.com/admin/clients/usuario_aux/
Django版本:1.7.3 Python版本:2.7.9已安装的应用程序: (' django.contrib.admin.apps.SimpleAdminConfig&#39 ;, ' django.contrib.auth',' django.contrib.contenttypes', ' django.contrib.sessions',' django.contrib.messages', ' django.contrib.staticfiles',' adminplus',' clients',' currier') 已安装的中间件: (' django.contrib.sessions.middleware.SessionMiddleware&#39 ;, ' django.middleware.common.CommonMiddleware&#39 ;, ' django.middleware.csrf.CsrfViewMiddleware&#39 ;, ' django.contrib.auth.middleware.AuthenticationMiddleware&#39 ;, ' django.contrib.messages.middleware.MessageMiddleware&#39 ;, ' django.middleware.clickjacking.XFrameOptionsMiddleware&#39)
模板错误:在模板中 /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/contrib/admin/templates/admin/change_list.html,第91行的错误无法查找&# 39; U'在Usuario_aux或 Usuario_AuxAdmin 81:{%endif%}
82:{%endblock%}
83:
84:{%csrf_token%}
85:{%if cl.formset%}
86:{{cl.formset.management_form}}
87:{%endif%}
88:
89:{%block result_list%}
90:{%if action_form和actions_on_top and cl.full_result_count%} {%admin_actions%} {%endif%}
91:{%result_list cl%}
92:{%if action_form和actions_on_bottom and cl.full_result_count%} {%admin_actions%} {%endif%}
93:{%endblock%}
94:{%block pagination%} {%pagination cl%} {%endblock%}
95:
96:
97:
98:{%endblock%}
99:
回溯:文件 " /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/core/handlers/base.py" 在get_response中 137. response = response.render()File" /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/template/response.py" ; 在渲染中 103. self.content = self.rendered_content File" /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/template/response.py" ; 在rendered_content中 80. content = template.render(context)File" /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/template/base.py 34; 在渲染中 148. return self._render(context)File" /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/template/base.py" ; 在_render 142. return self.nodelist.render(context)File" /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/template/base.py& #34; 在渲染中 844. bit = self.render_node(node,context)File" /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/template/debug。 PY" 在render_node中 80. return node.render(context)File" /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/template/loader_tags.py" ; 在渲染中 126. return compiled_parent._render(context)File" /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/template/base.py" ; 在_render 142. return self.nodelist.render(context)File" /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/template/base.py& #34; 在渲染中 844. bit = self.render_node(node,context)File" /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/template/debug。 PY" 在render_node中 80. return node.render(context)File" /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/template/loader_tags.py" ; 在渲染中 126. return compiled_parent._render(context)File" /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/template/base.py" ; 在_render 142. return self.nodelist.render(context)File" /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/template/base.py& #34; 在渲染中 844. bit = self.render_node(node,context)File" /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/template/debug。 PY" 在render_node中 80. return node.render(context)File" /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/template/loader_tags.py" ; 在渲染中 65. result = block.nodelist.render(context)File" /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/template/base。 PY" 在渲染中 844. bit = self.render_node(node,context)File" /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/template/debug。 PY" 在render_node中 80. return node.render(context)File" /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/template/loader_tags.py" ; 在渲染中 65. result = block.nodelist.render(context)File" /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/template/base。 PY" 在渲染中 844. bit = self.render_node(node,context)File" /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/template/debug。 PY" 在render_node中 80. return node.render(context)File" /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/template/base.py" ; 在渲染中 1207. _dict = func(* resolved_args,** resolved_kwargs)File" /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/contrib/admin /templatetags/admin_list.py" 在result_list中 307. headers = list(result_headers(cl))File" /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/contrib/admin/templatetags /admin_list.py" 在result_headers中 101. return_attr = True File" /home/jetint/webapps/jet_test/lib/python2.7/Django-1.7.3-py2.7.egg/django/contrib/admin/utils.py" 在label_for_field中 324.引发AttributeError(消息)
异常类型:/ admin / clients / usuario_aux /中的AttributeError 例外价值:无法查找' u'在Usuario_aux或 Usuario_AuxAdmin
我怎么能解决这个问题?
模特:
class Usuario_aux(models.Model):
user = models.ForeignKey(User)
clave = models.CharField(max_length=100)
correo = models.BooleanField(default=False)
admin.py:
class Usuario_AuxAdmin(admin.ModelAdmin):
list_display = ('user', 'correo')
search_fields = ('user', 'correo')
admin.site.register(Usuario_aux, Usuario_AuxAdmin)