Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An issue with the database query that's supposed to retrieve the "notification" object. #371

Open
c0d33py opened this issue Sep 15, 2023 · 1 comment

Comments

@c0d33py
Copy link

c0d33py commented Sep 15, 2023

The AttributeError occurs when attempting to call "_base_manager" on the model class associated with the "notification" object. This suggests that the "notification" object is expected to be a Django model instance, but it is None, hence the error.

Internal Server Error: /notifications/api/all_list/
Traceback (most recent call last):
  File "/project/env/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/project/env/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/project/env/lib/python3.10/site-packages/django/views/decorators/cache.py", line 62, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/project/env/lib/python3.10/site-packages/notifications/views.py", line 191, in live_all_notification_list
    all_list = get_notification_list(request)
  File "/project/env/lib/python3.10/site-packages/notifications/helpers.py", line 25, in get_notification_list
    if notification.target:
  File "/project/env/lib/python3.10/site-packages/django/contrib/contenttypes/fields.py", line 250, in __get__
    rel_obj = ct.get_object_for_this_type(pk=pk_val)
  File "/project/env/lib/python3.10/site-packages/django/contrib/contenttypes/models.py", line 179, in get_object_for_this_type
    return self.model_class()._base_manager.using(self._state.db).get(**kwargs)
AttributeError: 'NoneType' object has no attribute '_base_manager'
@AlvaroLQueiroz
Copy link
Contributor

Can you give the steps to reproduce this error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants