This commit is contained in:
koksnuss 2020-05-12 21:04:12 +02:00
parent c6abd72681
commit 60c500d219
2 changed files with 4 additions and 7 deletions

View File

@ -129,11 +129,11 @@ function render_response(data, td, set) {
if (set['found'] && set['found_by'] && set['exists']) { if (set['found'] && set['found_by'] && set['exists']) {
div_class = set['found_by']; div_class = set['found_by'];
$(td).find('div.coin span').html('').html('x'); $(td).find('div.coin span').html('').html('x');
/* add/update name */
if ('name' in data) { if ('name' in data) {
console.log(data['name']);
let c = String(value).substring(2,3); let c = String(value).substring(2,3);
let div_special_name = $(td).find('div.special' + c + '_name'); let div_special_name = $(td).find('div.special' + c + '_name');
console.log(div_special_name);
if (div_special_name.length == 0) { if (div_special_name.length == 0) {
$(td).append('<div class="special' + c + '_name three_lines">' + data['name'] + '</div>'); $(td).append('<div class="special' + c + '_name three_lines">' + data['name'] + '</div>');
} else if (div_special_name.length == 1) { } else if (div_special_name.length == 1) {
@ -154,9 +154,6 @@ function render_response(data, td, set) {
/* apply div overlay styles */ /* apply div overlay styles */
$(td).find('div[type=overlay]').removeClass(); $(td).find('div[type=overlay]').removeClass();
$(td).find('div[type=overlay]').addClass('found ' + div_class); $(td).find('div[type=overlay]').addClass('found ' + div_class);
//TODO add text to Sondermünzen :))
} }

View File

@ -277,7 +277,7 @@ def add_coin(request):
ec = False ec = False
else: else:
name = request.POST['name'] if request.POST['name'] else '' name = request.POST.get('name', '')
try: try:
name = str(name) name = str(name)
except Exception as e: except Exception as e:
@ -328,7 +328,7 @@ def add_coin(request):
coin.checked = checked coin.checked = checked
coin.in_collector = ec coin.in_collector = ec
coin.exists = exists coin.exists = exists
coin.save() coin.save(force_update=True)
except Coin.DoesNotExist: except Coin.DoesNotExist:
Coin.objects.create( Coin.objects.create(