2022-06-17 10:33:13 +00:00
|
|
|
# Copyright © 2022 Aravinth Manivannan <realaravinth@batsense.net>
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Affero General Public License as
|
|
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
|
|
# License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Affero General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
from django.shortcuts import render, redirect, get_object_or_404
|
|
|
|
from django.utils.http import urlencode
|
|
|
|
from django.contrib.auth import authenticate, login, logout
|
|
|
|
from django.contrib.auth import get_user_model
|
|
|
|
from django.contrib.auth.decorators import login_required
|
|
|
|
from django.http import HttpResponse
|
|
|
|
from django.views.decorators.csrf import csrf_protect
|
|
|
|
from django.urls import reverse
|
|
|
|
|
2022-06-17 11:29:20 +00:00
|
|
|
|
|
|
|
def default_ctx(title: str, username: str):
|
|
|
|
"""
|
|
|
|
Default context for all dashboard pages
|
|
|
|
"""
|
2022-06-17 10:33:13 +00:00
|
|
|
return {
|
|
|
|
"title": title,
|
2022-06-17 11:29:20 +00:00
|
|
|
"username": username,
|
2022-06-17 10:33:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@login_required
|
|
|
|
def home(request):
|
2022-06-17 11:29:20 +00:00
|
|
|
"""
|
|
|
|
Dashboard homepage view
|
|
|
|
"""
|
2022-06-17 10:33:13 +00:00
|
|
|
PAGE_TITLE = "Home"
|
2022-06-17 11:29:20 +00:00
|
|
|
username = request.user
|
|
|
|
ctx = default_ctx(title=PAGE_TITLE, username=username.username)
|
2022-06-17 10:33:13 +00:00
|
|
|
|
|
|
|
return render(request, "dash/home/index.html", context=ctx)
|