from django.http import HttpResponse, Http404
from django.template import TemplateDoesNotExist
from django.template.loader import get_template
from django.shortcuts import render
from django.contrib.auth.views import LoginView, LogoutView
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.decorators import login_required
def MyLoginView(LoginView):
template_name = 'main/login.html'
def MyLogoutView(LoginRequiredMixin,LogoutView):
template_name = 'main/logout.html'
...
from django.urls import path
from .views import index, other_page, MyLoginView, MyLogoutView, profile
app_name='main'
urlpatterns = [
path('accounts/login/', MyLoginView.as_view(), name='login'),
path('accounts/logout/', MyLogoutView.as_view(), name='logout'),
....
]
File "./bboard/main/urls.py", line 7, in
path('accounts/login/', MyLoginView.as_view(), name='login'),
AttributeError: 'function' object has no attribute 'as_view'