From 5d088f0461a4bf1743a7a860cc192f22de528591 Mon Sep 17 00:00:00 2001 From: koksnuss Date: Mon, 11 May 2020 14:57:12 +0200 Subject: [PATCH] fix #15 --- coinmanager/coinc/models.py | 4 +- coinmanager/coinc/static/coinc/main.js | 147 ++++++++++++------------- coinmanager/coinc/views.py | 12 +- 3 files changed, 74 insertions(+), 89 deletions(-) diff --git a/coinmanager/coinc/models.py b/coinmanager/coinc/models.py index 3496ef8..0c3276a 100644 --- a/coinmanager/coinc/models.py +++ b/coinmanager/coinc/models.py @@ -28,9 +28,9 @@ year_now = int(datetime.now().year) class User(Model): - name = CharField('Name', max_length=50, default='Anonym') + name = CharField('Name', max_length=20, default='Anonym') - color = CharField('Farbe', max_length=20, default='white') + color = CharField('Farbe', max_length=20, default='purple') def __str__(self): diff --git a/coinmanager/coinc/static/coinc/main.js b/coinmanager/coinc/static/coinc/main.js index 0a3a01b..6d4790f 100644 --- a/coinmanager/coinc/static/coinc/main.js +++ b/coinmanager/coinc/static/coinc/main.js @@ -44,13 +44,11 @@ function get_datetime() { // manage user login -function render_login(input_name, input_color) { +function render_login(name, color) { - let color = decodeURIComponent(input_color); - let name = decodeURIComponent(input_name); new Cookie('coinc-name', name) - render_login_color(color); + let option = $('nav.navbar option[value=' + name + ']'); if (option.length == 0) { $('nav.navbar select').append($('