This commit is contained in:
Ross
2021-02-15 16:46:05 +00:00
parent 830eea0a09
commit 9f1ff2cdc8
3 changed files with 30 additions and 7 deletions
@@ -0,0 +1,18 @@
# Generated by Django 3.1.5 on 2021-02-15 16:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('longs', '0018_auto_20210215_1052'),
]
operations = [
migrations.AddField(
model_name='longseriesimage',
name='upload_filename',
field=models.CharField(blank=True, max_length=255),
),
]
+1
View File
@@ -151,6 +151,7 @@ def test_image_validator(file):
class LongSeriesImage(models.Model):
image = models.FileField(upload_to=image_directory_path)
position = models.IntegerField(default=0)
upload_filename = models.CharField(max_length=255, blank=True)
series = models.ForeignKey(
"LongSeries", related_name="images", on_delete=models.SET_NULL, null=True
)
+11 -7
View File
@@ -193,7 +193,6 @@
$(`img[data-input-id='${input.id}'`).removeClass("image-ident-loading");
console.log(l);
if (l.includes("accesion") || l.includes("number") || l.search(/(ref|rk9|rh8|ra9|rbz)\d+/g) > -1) {
console.log("SHIT", input);
$(input).addClass("image-ident-warning");
$(`img[data-input-id='${input.id}'`).addClass("image-ident-warning");
} else {
@@ -218,13 +217,14 @@
});
}
const readFile = (file) => {
const readFile = (file, el) => {
reader(file).then(reader => {
var image = new Image();
image.height = 100;
image.title = file.name;
image.src = reader.result;
$("#images").append(image);
console.log("read" ,el);
$(el).parent().parent().preppend(image);
//images.push(reader.result);
loadViewer(images);
});
@@ -239,7 +239,7 @@
console.log(el);
if (el.files.length > 0) {
filename = el.files[0].name;
await readFile(el.files[0]);
await readFile(el.files[0], el);
}
})
@@ -261,7 +261,7 @@
}
}
image_set = $("#images img");
image_set = $("#image_form_set img");
if (n == image_set.length) {
const event = new CustomEvent('loadDicomViewer', { "detail": images });
@@ -282,9 +282,13 @@
console.log(ul)
file_element = $(ul).find("input[type=file]").get(0);
console.log(file_element);
""
// If a (new) file is being uploaded we save it's name prior to it being hashed
if (file_element.files.length > 0) {
file_name = file_element.files[0].name
$(ul).find("input[type=text]").val(file_name);
}
if (file_element.files.length > 0 || $(ul).find(":contains('Currently:')")) {
n++;
$(ul).find("input[type=number]").val(n);