Authentication Issue
Closed this issue · 1 comments
It seems that the notification endpoints assume that request are authenticated causing an exception when request is made by anonymous user:
Internal Server Error: /api/v1/notifications/
Traceback (most recent call last):
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
response = get_response(request)
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\views\generic\base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\views\generic\base.py", line 97, in dispatch
return handler(request, *args, **kwargs)
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\views\generic\list.py", line 142, in get
self.object_list = self.get_queryset()
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\notifications\views.py", line 30, in get_queryset
return queryset.filter(recipient=self.request.user)
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\db\models\query.py", line 892, in filter
return self._filter_or_exclude(False, *args, **kwargs)
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\db\models\query.py", line 910, in _filter_or_exclude
clone.query.add_q(Q(*args, **kwargs))
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\db\models\sql\query.py", line 1290, in add_q
clause, _ = self._add_q(q_object, self.used_aliases)
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\db\models\sql\query.py", line 1318, in _add_q
split_subq=split_subq, simple_col=simple_col,
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\db\models\sql\query.py", line 1224, in build_filter
self.check_related_objects(join_info.final_field, value, join_info.opts)
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\db\models\sql\query.py", line 1086, in check_related_objects
for v in value:
File "C:\Users\fendy.virtualenvs\collegeapp\lib\site-packages\django\utils\functional.py", line 257, in inner
return func(self._wrapped, *args)
TypeError: 'AnonymousUser' object is not iterable
Yeah, that was the assumption.
This functionality has been removed and there's no API anymore.
It's up to the developer to build an API around django-notifs if they need to.
I'll close this now but feel free to open other issues.