Kumi
9fbfe583be
Reinforced user data access rules to bolster security and reorganized distribution files into separate directories for cleaner structure. Added a new heatmap visualization for mood statistics on the dashboard, making user engagements more interactive and insightful. Implemented a JSON view to support the heatmap feature, fetching mood entries within a specified time range. This change responds to the need for improved data security and a more engaging user interface, directly addressing user feedback for clearer insights into their mood patterns over time.
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
from django.views.generic import TemplateView, CreateView
|
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
|
from django.contrib.auth.forms import UserCreationForm
|
|
from django.contrib.auth import get_user_model, login
|
|
from django.urls import reverse_lazy
|
|
|
|
|
|
class DashboardView(LoginRequiredMixin, TemplateView):
|
|
template_name = "frontend/dashboard.html"
|
|
|
|
def get_context_data(self, **kwargs):
|
|
context = super().get_context_data(**kwargs)
|
|
context["title"] = "Dashboard"
|
|
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"]
|
|
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):
|
|
return reverse_lazy("frontend:dashboard")
|