from django.views.generic import TemplateView
from django.contrib import auth
from django.contrib import messages
from django import http


class LoginView(TemplateView):
    template_name = "admin/login.html"

    def post(self, request):
        username = request.POST['username']
        password = request.POST['password']
        user_object = auth.authenticate(request, username=username, password=password)
        if user_object is None:
            messages.error(request, "Invalid credentials")
            return self.get(request)
        auth.login(request, user_object)
        messages.success(request, "You've been logged in")
        return http.HttpResponseRedirect("/administration/panel")


class Panel(TemplateView):
    template_name = "admin/panel.html"




@@ -1,20 +1,50 @@
+from django.views import View%0A
 from django.views.ge
@@ -801,10 +801,157 @@
 .html%22%0A%0A
+%0Aclass LogoutView(View):%0A    def get(self, request):%0A        auth.logout(request)%0A        return http.HttpResponseRedirect(%22/administration/login%22)
 %0A%0A

Create logout view