AttributeError at /login/ Объект 'NoneType' не имеет атрибута 'has_header' [закрыто]

I do authorization on the django site using this guide: https://proproprogs.ru/django/delaem-avtorizaciyu-polzovateley-na-sayte.

I created views

class LoginUser(DataMixin, LoginView):
    form_class = AuthenticationForm
    template_name = 'shop/login.html'

    def get_context_data(self, *, object_list=None, **kwargs):
        context = super().get_context_data(**kwargs)
        c_def = self.get_user_context(title="Авторизация")
        return dict(list(context.items()) + list(c_def.items()))

then in urls.py I added path login

urlpatterns = [
    path('', index, name='index'),
    path('add_product', add_product, name='add_product'),
    path('login/', LoginUser.as_view(), name='login'),
]

but when I go to the site through http://127.0.0.1:8000/login/ I get an error

AttributeError at /login/ У объекта 'NoneType' нет атрибута 'has_header'

I tried googling, but there is no such a problem as mine, mostly written about render and HttpRequest, but in my code it is not even where to write.

I tried googling, but there is no such a problem as mine, mostly written about render and HttpRequest, but in my code it is not even where to write.

Вернуться на верх