KeyError: 'request' с django-notifications-hq и Django 3.2

Я использую django-notifications-hq и недавно обновил свой проект с Django версии 2.2 до 3.2. С тех пор я получаю KeyError: 'response' всякий раз, когда пытаюсь получить доступ к шаблону, использующему тег notifications_unread templatetag. Используя django-debug-toolbar, я смог заметить, что контекст шаблона больше не имеет ключа request, который присутствовал до обновления. Что я здесь упускаю?

Отслеживание:

Template error:
In template /var/www/my_project/src/my_project/mp_frontend/templates/front/notifications.html, error at line 10
   request
   1 : {% load user_profile_tags %}
   2 : {% load notifications_tags %}
   3 : {% load i18n %}
   4 : {% load custom_notification_tags %}
   5 : 
   6 : <li class="dropdown notification-list">
   7 :     <a class="nav-link dropdown-toggle  waves-effect" data-toggle="dropdown" href="#" role="button"
   8 :        aria-haspopup="false" aria-expanded="false">
   9 :         <i class="far fa-bell">
   10 :              {% notifications_unread as unread_count %} 
   11 :             {% if unread_count %}
   12 :                 <span class="badge badge-danger rounded-circle noti-icon-badge">{{ unread_count }}</span>
   13 :             {% endif %}
   14 :         </i>
   15 :     </a>

Мой код:

def list_products(request):
    profile = get_user_profile_from_request(request)
    context = {'user_tkn': profile.generate_new_token()}
    return render(request, 'label_catalog/products/index.html', context=context)

А если я изменю его на:

def list_products(request):
    profile = get_user_profile_from_request(request)
    context = {'request':request, 'user_tkn': profile.generate_new_token()}
    return render(request, 'label_catalog/products/index.html', context=context)

все работает нормально. Я просмотрел проблемы django-notifications-hq и примечания к релизу Django, но не нашел ничего полезного

Примечание: шаблон products/index.html включает front/notifications.html так: {% include 'front/notifications.html' %}

В итоге выяснилось, что проблема была между клавиатурой и сиденьем. В процессе обновления версии Django, по какой-то причине я закомментировал обработчик контекста запроса в settings.py. Вот мои шаблоны настроек для тех, кто может столкнуться с этой проблемой:

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['my_project/mp_frontend/templates'],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',  # this line waas the key
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]
Вернуться на верх