From 676e9b94a56a45fc1c483fb87addc7aa2039e14b Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Fri, 25 Oct 2019 13:33:37 +0200 Subject: [PATCH] First draft of dashboard view. --- musician/mixins.py | 14 ++++++++ musician/templates/musician/dashboard.html | 40 ++++++++++++++++++++++ musician/urls.py | 1 + musician/views.py | 8 ++++- 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 musician/mixins.py create mode 100644 musician/templates/musician/dashboard.html diff --git a/musician/mixins.py b/musician/mixins.py new file mode 100644 index 0000000..cbc7592 --- /dev/null +++ b/musician/mixins.py @@ -0,0 +1,14 @@ +from django.views.generic.base import ContextMixin + +from . import get_version + + +class CustomContextMixin(ContextMixin): + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + # TODO generate menu items + context.update({ + 'version': get_version(), + }) + + return context diff --git a/musician/templates/musician/dashboard.html b/musician/templates/musician/dashboard.html new file mode 100644 index 0000000..c5a653a --- /dev/null +++ b/musician/templates/musician/dashboard.html @@ -0,0 +1,40 @@ +{% extends "musician/base.html" %} +{% load i18n %} + +{% block content %} + +

Welcome back {{ user.username }}

+

Last time you logged in was {{ user.last_login }}

+ +
+ {% for i in "1234"|make_list %} +
+ Resource usage block +
+ {% endfor %} +
+ + +

Domains and websites

+

Little description of what to be expected...

+ +{% for i in "123"|make_list %} +
+
+

domain.com

+
+ {% for service in "123"|make_list %} +
+
+
{% cycle 'Mail' 'Mailing list' 'Databases' %}
+
+ Card image cap +
+

Some quick example text to build on the card title and make up the bulk of the card's + content.

+
+
+ {% endfor card %} +
+{% endfor %} +{% endblock %} diff --git a/musician/urls.py b/musician/urls.py index a3188fb..10cbdf4 100644 --- a/musician/urls.py +++ b/musician/urls.py @@ -16,4 +16,5 @@ urlpatterns = [ path('auth/login/', auth_views.LoginView.as_view(template_name='auth/login.html', extra_context={'version': '0.1'}), name='login'), # path('auth/logout/', views.LogoutView.as_view(), name='logout'), + path('dashboard/', views.DashboardView.as_view(), name='dashboard'), ] diff --git a/musician/views.py b/musician/views.py index 91ea44a..1102473 100644 --- a/musician/views.py +++ b/musician/views.py @@ -1,3 +1,9 @@ +from django.contrib.auth.mixins import LoginRequiredMixin from django.shortcuts import render +from django.views.generic.base import TemplateView -# Create your views here. +from .mixins import CustomContextMixin + + +class DashboardView(CustomContextMixin, TemplateView): ## TODO LoginRequiredMixin + template_name = "musician/dashboard.html"