If the permissions to add+edit+delete participants are granted to a user, who is not a superuser and who is not an Admin of a Team, then the user gets Error 500 when clicking on Participants link in admin panel. The corresponding stacktrace is:
Internal Server Error: /admin/IPT_TTH2019YUG/participant/
RelatedObjectDoesNotExist at /admin/IPT_TTH2019YUG/participant/
User has no Team_IPT_TTH2019YUG.
Request Method: GET
Request URL: https://connect.iptnet.info/admin/IPT_TTH2019YUG/participant/
Django Version: 1.11.7
Python Executable: /usr/bin/python
Python Version: 2.7.13
...
Traceback:
File "/home/kim/.local/lib/python2.7/site-packages/django/core/handlers/exception.py" in inner
41. response = get_response(request)
File "/home/kim/.local/lib/python2.7/site-packages/django/core/handlers/base.py" in _legacy_get_response
249. response = self._get_response(request)
File "/home/kim/.local/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "/home/kim/.local/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/kim/.local/lib/python2.7/site-packages/django/contrib/admin/options.py" in wrapper
551. return self.admin_site.admin_view(view)(*args, **kwargs)
File "/home/kim/.local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
149. response = view_func(request, *args, **kwargs)
File "/home/kim/.local/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
57. response = view_func(request, *args, **kwargs)
File "/home/kim/.local/lib/python2.7/site-packages/django/contrib/admin/sites.py" in inner
224. return view(request, *args, **kwargs)
File "/home/kim/.local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapper
67. return bound_func(*args, **kwargs)
File "/home/kim/.local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
149. response = view_func(request, *args, **kwargs)
File "/home/kim/.local/lib/python2.7/site-packages/django/utils/decorators.py" in bound_func
63. return func.__get__(self, type(self))(*args2, **kwargs2)
File "/home/kim/.local/lib/python2.7/site-packages/django/contrib/admin/options.py" in changelist_view
1542. self.list_max_show_all, self.list_editable, self,
File "/home/kim/.local/lib/python2.7/site-packages/django/contrib/admin/views/main.py" in __init__
44. self.root_queryset = model_admin.get_queryset(request)
File "/home/kim/kim/IPT_TTH2019YUG/admin.py" in get_queryset
115. return qs.filter(team = u.Team_IPT_TTH2019YUG)
File "/home/kim/.local/lib/python2.7/site-packages/django/db/models/fields/related_descriptors.py" in __get__
407. self.related.get_accessor_name()
Exception Type: RelatedObjectDoesNotExist at /admin/IPT_TTH2019YUG/participant/
Exception Value: User has no Team_IPT_TTH2019YUG.
First of all, there should be no 500 error. There should be a human-readable page instead which explains how to edit participants:
If you have the right to edit teams, go to the team of target participant, make yourself the admin of the team, then navigate to participants menu, change the desired participant or add new one, and then revert the adminship (because each user can be Team Admin of only one team).
If the permissions to add+edit+delete participants are granted to a user, who is not a superuser and who is not an Admin of a Team, then the user gets Error 500 when clicking on
Participants
link in admin panel. The corresponding stacktrace is:...
First of all, there should be no 500 error. There should be a human-readable page instead which explains how to edit participants: If you have the right to edit teams, go to the team of target participant, make yourself the admin of the team, then navigate to participants menu, change the desired participant or add new one, and then revert the adminship (because each user can be Team Admin of only one team).
The same thing for
/IPTdev/member_for_team
See also #184