Restructured everything.

This commit is contained in:
2019-10-08 14:50:10 +02:00
parent 5336de4959
commit 587c2849b6
46 changed files with 102 additions and 328 deletions

23
apps/base/views.py Normal file
View File

@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
import socket
from django.utils import timezone
from django.views import generic
class RootView(generic.TemplateView):
template_name = 'base/root.html'
def get_context_data(self, **kwargs):
if 'hostname' not in kwargs:
kwargs['hostname'] = socket.gethostname()
if 'color_hex' not in kwargs:
buf = kwargs['hostname']
buf = re.sub('[-.]', '', buf)
buf = buf[:6].lower()
if re.match('[0-9a-f]{6}', buf):
kwargs['color_hex'] = buf
if 'time' not in kwargs:
kwargs['time'] = timezone.now()
return super(RootView, self).get_context_data(**kwargs)