"""
Base views and utilities.
"""
from django.contrib.auth import logout
from django.shortcuts import redirect, render
from django.views import View


class ActionsPageView(View):
    """View for displaying the actions page."""
    
    def get(self, request):
        if request.user.is_authenticated:
            return render(request, "mainapp/actions.html")
        else:
            return render(request, "mainapp/login_required.html")


def custom_logout(request):
    """Custom logout view."""
    logout(request)
    return redirect("mainapp:home")
