You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's a very strange situation: I'm using django-notifications-hq in my app, and if I call the notifications list from model user, I can see all user notifications:
But when I made a call by Api rest, well, I can see that the result is ever empty:
Debugging your def live_all_notification_list(request): I've noted that request.user is always an anonymous user.
Again: I've tryed to override your live_all_notification_list in mine main.view() (with a new url: path("v1/notifications/unread_list/", main_views.live_all_notification_list), to avoid potential urls conflicts) and I've discovered that the problem is the decorator @never_cache, indeed, updating this decorator with a more generic @api_view(["GET"]), all work like a charm:
And last but not least, I've updated in your library view the decorator as @api_view(["GET"]) instead of @never_cache, and this is the result:
All work fine, and the result is the same as view method override.
This may be a bug or exist a workaround to bypass this empasse?
Thank you guys for your work and for your help,
Mauro
The text was updated successfully, but these errors were encountered:
I believe this is not a bug on this lib, because the never_cache and the django-notifications don't change the request, If the user is arriving as Anonymous some code before this is making this change, probably some middleware.
It's a very strange situation: I'm using django-notifications-hq in my app, and if I call the notifications list from model user, I can see all user notifications:
But when I made a call by Api rest, well, I can see that the result is ever empty:
Debugging your
def live_all_notification_list(request):
I've noted thatrequest.user
is always an anonymous user.Again: I've tryed to override your
live_all_notification_list
in minemain.view()
(with a new url:path("v1/notifications/unread_list/", main_views.live_all_notification_list)
, to avoid potential urls conflicts) and I've discovered that the problem is the decorator@never_cache
, indeed, updating this decorator with a more generic@api_view(["GET"])
, all work like a charm:And last but not least, I've updated in your library view the decorator as
@api_view(["GET"])
instead of@never_cache
, and this is the result:All work fine, and the result is the same as view method override.
This may be a bug or exist a workaround to bypass this empasse?
Thank you guys for your work and for your help,
Mauro
The text was updated successfully, but these errors were encountered: