First draft of dashboard view.

This commit is contained in:
Santiago Lamora 2019-10-25 13:33:37 +02:00
parent dc1de203d0
commit 676e9b94a5
4 changed files with 62 additions and 1 deletions

14
musician/mixins.py Normal file
View File

@ -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

View File

@ -0,0 +1,40 @@
{% extends "musician/base.html" %}
{% load i18n %}
{% block content %}
<h2>Welcome back {{ user.username }}</h2>
<h3>Last time you logged in was {{ user.last_login }}</h3>
<div class="row">
{% for i in "1234"|make_list %}
<div class="col-3 border">
Resource usage block
</div>
{% endfor %}
</div>
<h1>Domains and websites</h1>
<p>Little description of what to be expected...</p>
{% for i in "123"|make_list %}
<div class="row border mt-4">
<div class="col-12 bg-light">
<h3>domain.com</h3>
</div>
{% for service in "123"|make_list %}
<div class="card" style="width: 18rem;">
<div class="card-body">
<h5 class="card-title">{% cycle 'Mail' 'Mailing list' 'Databases' %}</h5>
</div>
<img class="card-img-bottom" src="..." alt="Card image cap">
<div class="card-body">
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's
content.</p>
</div>
</div>
{% endfor card %}
</div>
{% endfor %}
{% endblock %}

View File

@ -16,4 +16,5 @@ urlpatterns = [
path('auth/login/', auth_views.LoginView.as_view(template_name='auth/login.html', path('auth/login/', auth_views.LoginView.as_view(template_name='auth/login.html',
extra_context={'version': '0.1'}), name='login'), extra_context={'version': '0.1'}), name='login'),
# path('auth/logout/', views.LogoutView.as_view(), name='logout'), # path('auth/logout/', views.LogoutView.as_view(), name='logout'),
path('dashboard/', views.DashboardView.as_view(), name='dashboard'),
] ]

View File

@ -1,3 +1,9 @@
from django.contrib.auth.mixins import LoginRequiredMixin
from django.shortcuts import render 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"