from django.shortcuts import render, redirect

def logout_view(func):
    def wrapper(request):
        if request.method == 'POST':
            request.session.clear()
            return redirect ('login')
        return func(request)
    return wrapper