2020-12-31 21:17:02 +00:00
|
|
|
from django.views.generic import TemplateView, CreateView
|
2020-12-27 17:49:54 +00:00
|
|
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
2020-12-31 21:17:02 +00:00
|
|
|
from django.contrib.auth.forms import UserCreationForm
|
|
|
|
from django.contrib.auth import get_user_model, login
|
|
|
|
from django.urls import reverse_lazy
|
2020-12-27 17:49:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
class DashboardView(LoginRequiredMixin, TemplateView):
|
|
|
|
template_name = "frontend/dashboard.html"
|
|
|
|
|
|
|
|
def get_context_data(self, **kwargs):
|
|
|
|
context = super().get_context_data(**kwargs)
|
|
|
|
context["title"] = "Dashboard"
|
2024-05-17 13:03:20 +00:00
|
|
|
context["subtitle"] = (
|
|
|
|
"An overview of everything going on in your Kumify account."
|
|
|
|
)
|
|
|
|
context["scripts"] = [
|
|
|
|
"frontend/dist/js/d3.v7.min.js",
|
|
|
|
"frontend/dist/js/cal-heatmap.min.js",
|
|
|
|
"frontend/js/dashboard.js",
|
|
|
|
]
|
|
|
|
context["styles"] = ["frontend/dist/css/cal-heatmap.css"]
|
2020-12-31 21:17:02 +00:00
|
|
|
return context
|
|
|
|
|
|
|
|
|
|
|
|
class UserRegistrationView(CreateView):
|
|
|
|
form_class = UserCreationForm
|
|
|
|
model = get_user_model()
|
|
|
|
template_name = "registration/registration_form.html"
|
|
|
|
|
|
|
|
def form_valid(self, form):
|
|
|
|
ret = super().form_valid(form)
|
|
|
|
login(self.request, self.object)
|
|
|
|
return ret
|
|
|
|
|
|
|
|
def get_success_url(self):
|
2024-05-17 13:03:20 +00:00
|
|
|
return reverse_lazy("frontend:dashboard")
|