pull/3/head
assar 8 years ago
parent 5eb3cb6e46
commit 750da21749

@ -98,7 +98,8 @@ def alter(partID):
datasheet_file = request.files['datasheet-file']
datasheet_filename = secure_filename(datasheet_file.filename)
datasheet_file.save('/srv/datasheets/' + datasheet_filename)
os.remove('/srv/datasheets/' + l[0]['datasheet'])
if l[0]['datasheet'] != None:
os.remove('/srv/datasheets/' + l[0]['datasheet'])
else:
datasheet_filename = l[0]['datasheet']
s += 'where id=:id;'

@ -203,7 +203,7 @@ function show_part_info(partID) {
$('#quantity-info').text(text_filter(data.quantity));
$('#notes-info').text(text_filter(data.notes));
if (data.datasheet != null)
$('#datasheet-info').append($('<a href="https://www.elab.kth.se/parts/getfile/' + data.datasheet.substring(0, data.datasheet.length - 4) + '"><i class="fa fa-file-text" aria-hidden="true"></i></a>'));
$('#datasheet-info').html($('<a href="https://www.elab.kth.se/parts/getfile/' + data.datasheet.substring(0, data.datasheet.length - 4) + '"><i class="fa fa-file-text" aria-hidden="true"></i></a>'));
else
$('#datasheet-info').text(' ');
$('#edit-button').click(function() {

Loading…
Cancel
Save