Open AdrienLemaire opened 5 years ago
Sorry for the lack of clarity, I'm just getting started with WagTail and don't yet understand the details behind it.
Here what I can see from a shell
In [27]: rf = Review.objects.first()
In [28]: PageRevision.objects.get(id=rf.page_revision_id)
Out[28]: <PageRevision: "Third post unpublished" at 2019-04-19 07:02:40.572529+00:00>
In [29]: [User.objects.get(id=r.user_id) for r in rf.reviewers.all()]
Out[29]: [<User: Reviewer>, <User: dori>]
In [30]: rl = Review.objects.last()
In [31]: PageRevision.objects.get(id=rl.page_revision_id)
Out[31]: <PageRevision: "4th post to review" at 2019-04-19 07:04:40.425567+00:00>
In [32]: [User.objects.get(id=r.user_id) for r in rl.reviewers.all()]
Out[32]: [<User: Reviewer>, <User: Reviewer>]
I do not know why my 3rd post has 2 reviewers. Is there some logic where unpublishing a post auto-assign reviewers? Strange... Also, no error happens when viewing it.
I suppose the relevant bug report here is that the same user can be assigned twice for the same review, which causes a 500 error. Why the review made as admin didn't show up first in the user Reviews page is another concern.
Traceback
```pytb Environment: Request Method: GET Request URL: http://localhost:8000/admin/wagtail_review/reviews/2/view/ Django Version: 2.1.8 Python Version: 3.7.3 Installed Applications: ['home', 'blog', 'search', 'wagtail.contrib.forms', 'wagtail.contrib.redirects', 'wagtail.embeds', 'wagtail.sites', 'wagtail.users', 'wagtail.snippets', 'wagtail.documents', 'wagtail.images', 'wagtail.search', 'wagtail.admin', 'wagtail.core', 'modelcluster', 'taggit', 'wagtail_review', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles'] Installed Middleware: ['django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', 'wagtail.core.middleware.SiteMiddleware', 'wagtail.contrib.redirects.middleware.RedirectMiddleware'] Traceback: File "/home/dori/.virtualenvs/project/lib/python3.7/site-packages/django/core/handlers/exception.py" in inner 34. response = get_response(request) File "/home/dori/.virtualenvs/project/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response 126. response = self.process_exception_by_middleware(e, request) File "/home/dori/.virtualenvs/project/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response 124. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/home/dori/.virtualenvs/project/lib/python3.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func 44. response = view_func(request, *args, **kwargs) File "/home/dori/.virtualenvs/project/lib/python3.7/site-packages/wagtail/admin/urls/__init__.py" in wrapper 102. return view_func(request, *args, **kwargs) File "/home/dori/.virtualenvs/project/lib/python3.7/site-packages/wagtail/admin/decorators.py" in decorated_view 34. return view_func(request, *args, **kwargs) File "/home/dori/.virtualenvs/project/lib/python3.7/site-packages/wagtail_review/views/admin.py" in view_review_page 133. reviewer = review.reviewers.get(user=request.user) File "/home/dori/.virtualenvs/project/lib/python3.7/site-packages/django/db/models/manager.py" in manager_method 82. return getattr(self.get_queryset(), name)(*args, **kwargs) File "/home/dori/.virtualenvs/project/lib/python3.7/site-packages/django/db/models/query.py" in get 403. (self.model._meta.object_name, num) Exception Type: MultipleObjectsReturned at /admin/wagtail_review/reviews/2/view/ Exception Value: get() returned more than one Reviewer -- it returned 2! ```Steps:
Seeing 2 issues here:
wagtail_review/views/admin.py
l.133)