Реструктуризация views
This commit is contained in:
22
dbapp/mainapp/views/base.py
Normal file
22
dbapp/mainapp/views/base.py
Normal file
@@ -0,0 +1,22 @@
|
||||
"""
|
||||
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")
|
||||
Reference in New Issue
Block a user