在add_status页面出现exception
africamonkey opened this issue · comments
使用superuser登录进去,提示 User has no userprofile.
以下是完整的调试信息。
Internal Server Error: /status/1/1/add_status/
Traceback (most recent call last):
File "/home/africamonkey/Documents/sysuclass/session4/python/project/teamwork/venv/lib/python3.6/site-packages/django/core/handlers/exception.py", line 35, in inner
response = get_response(request)
File "/home/africamonkey/Documents/sysuclass/session4/python/project/teamwork/venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 128, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/africamonkey/Documents/sysuclass/session4/python/project/teamwork/venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/africamonkey/Documents/sysuclass/session4/python/project/teamwork/summary/views.py", line 60, in add_status
form = StatusForm(contest_id=contest_id, user_id=user_id)
File "/home/africamonkey/Documents/sysuclass/session4/python/project/teamwork/summary/forms.py", line 28, in init
('1', user.userprofile.team_member_1),
File "/home/africamonkey/Documents/sysuclass/session4/python/project/teamwork/venv/lib/python3.6/site-packages/django/db/models/fields/related_descriptors.py", line 389, in get
self.related.get_accessor_name()
django.db.models.fields.related_descriptors.RelatedObjectDoesNotExist: User has no userprofile.
[17/Mar/2018 02:41:51] "GET /status/1/1/add_status/ HTTP/1.1" 500 81534
当然啦,superuser是没写profile的。
fix it. maybe.
user has no userprofile no longer allow to use add_status or display_status
@Dexan-Ou 在最新的commit中,我把没有userprofile的重定向到users:modify_profiles。