From 60c500d21938176e71bd917c4877d5044a5f5664 Mon Sep 17 00:00:00 2001 From: koksnuss Date: Tue, 12 May 2020 21:04:12 +0200 Subject: [PATCH] fix #2 --- coinmanager/coinc/static/coinc/main.js | 7 ++----- coinmanager/coinc/views.py | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/coinmanager/coinc/static/coinc/main.js b/coinmanager/coinc/static/coinc/main.js index d352ab5..5ccf1cb 100644 --- a/coinmanager/coinc/static/coinc/main.js +++ b/coinmanager/coinc/static/coinc/main.js @@ -129,11 +129,11 @@ function render_response(data, td, set) { if (set['found'] && set['found_by'] && set['exists']) { div_class = set['found_by']; $(td).find('div.coin span').html('').html('x'); + + /* add/update name */ if ('name' in data) { - console.log(data['name']); let c = String(value).substring(2,3); let div_special_name = $(td).find('div.special' + c + '_name'); - console.log(div_special_name); if (div_special_name.length == 0) { $(td).append('
' + data['name'] + '
'); } else if (div_special_name.length == 1) { @@ -154,9 +154,6 @@ function render_response(data, td, set) { /* apply div overlay styles */ $(td).find('div[type=overlay]').removeClass(); $(td).find('div[type=overlay]').addClass('found ' + div_class); - - - //TODO add text to Sondermünzen :)) } diff --git a/coinmanager/coinc/views.py b/coinmanager/coinc/views.py index fb8fd9f..c0619ef 100644 --- a/coinmanager/coinc/views.py +++ b/coinmanager/coinc/views.py @@ -277,7 +277,7 @@ def add_coin(request): ec = False else: - name = request.POST['name'] if request.POST['name'] else '' + name = request.POST.get('name', '') try: name = str(name) except Exception as e: @@ -328,7 +328,7 @@ def add_coin(request): coin.checked = checked coin.in_collector = ec coin.exists = exists - coin.save() + coin.save(force_update=True) except Coin.DoesNotExist: Coin.objects.create(