planarian

This commit is contained in:
2026-05-04 23:05:59 +02:00
parent c0c3c37963
commit 5c78c042a4
7 changed files with 31 additions and 26 deletions
+5 -11
View File
@@ -18,9 +18,9 @@ class ExperimentConfig(models.Model):
author = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name="Auteur", null=True, blank=True)
# --- Identification ---
identifier = models.CharField( max_length=100, verbose_name=_("Identifiant d'expérience"), help_text=_("session_1-HD-2026-04-27"), )
experiment = models.ForeignKey(Experiment, verbose_name="Expérience", on_delete=models.CASCADE, related_name="experiment_well" , null=True, blank=True)
well = models.ForeignKey(Well, verbose_name="Puit", on_delete=models.CASCADE, related_name="well_experiment", null=True, blank=True )
identifier = models.CharField( max_length=100, verbose_name=_("Identifiant d'expérience"), help_text=_("session_1-HD-2026-04-27"), null=True, blank=True )
experiment = models.ForeignKey(Experiment, verbose_name="Expérience", on_delete=models.CASCADE, related_name="experiment_well", null=True, blank=False)
well = models.ForeignKey(Well, verbose_name="Puit", on_delete=models.CASCADE, related_name="well_experiment", null=True, blank=False )
description = models.TextField( blank=True, verbose_name=_("Description"), )
created_at = models.DateTimeField(auto_now_add=True, verbose_name=_("Créé le"))
@@ -162,10 +162,7 @@ class ExperimentConfig(models.Model):
def save(self, *args, **kwargs):
session = self.get_session()
dte = self.experiment.created.isoformat()[:19]
self.identifier = f'{dte}-{session.id}-{self.experiment.id}-{self.experiment.multiwell.position}-{self.well.name}'
print(self.identifier)
self.identifier = f'{dte}-{session.id}-{self.experiment.id}-{self.experiment.multiwell.position}-{self.well.name}'
super().save(*args, **kwargs)
@@ -179,7 +176,4 @@ def create_well_position(sender, instance, created, **kwargs):
conf = ScannerConstants().get()
instance.fps = conf.video_frame_rate
instance.save()
@@ -3,7 +3,8 @@
{% block columns %}{% endblock %}
{% block sidebar_list %}
{#% block sidebar_list %#}
<!--
<a href="/" class="w3-bar-item w3-btn w3-hover-opacity"><i class="fa-solid fa-house w3-text-orange w3-xlarge"></i> {% trans "Retour accueil" %}</a>
<form method="post" class="w3-bar-item" action="">
{% csrf_token %}
@@ -28,7 +29,8 @@
<i class="fa-solid fa-film w3-text-green w3-xlarge""></i> {% trans "Balayage multi-puits" %}
</a>
{% endif %}
{% endblock %}
-->
{#% endblock %#}
{% block js_footer %}
{{ block.super }}
@@ -46,8 +48,8 @@
setTimeout(function() {
message.remove();
}, 500);
}, 5000); // 5 seconds
}, 15000); // 15 seconds
});
});
</script>
{% endblock %}
{% endblock %}
@@ -2,7 +2,7 @@
{% load i18n home_tags scanner_tags %}
{% block content %}
<div class="w3-container w3-padding-32" style="max-width:1200px; margin:auto;">
<div class="w3-container w3-padding" style="max-width:1200px; margin:auto;">
<!-- En-tête -->
<div class="w3-panel w3-teal w3-round-large w3-padding-16 w3-margin-bottom">
@@ -24,11 +24,12 @@
<!-- Messages Django -->
{% for message in messages %}
<div class="w3-panel w3-round
<div class="w3-panel w3-round alert
{% if message.tags == 'success' %}w3-green
{% elif message.tags == 'error' %}w3-red
{% elif message.tags == 'warning' %}w3-orange
{% else %}w3-blue{% endif %}">
<button class="w3-btn w3-right w3-bold w3-black w3-round w3-margin" onclick="s('.alert').remove()">X</button>
<p>{{ message }}</p>
</div>
{% endfor %}
+8
View File
@@ -68,10 +68,18 @@ class ExperimentConfigListView(ListView):
context_object_name = "configs"
ordering = ["-created_at"]
'''
def get_queryset(self):
# Récupérer le queryset de base
queryset = ExperimentConfig.objects.filter(experiment__session_experiments__isnull=False).select_related()
return queryset'''
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
return global_context(self.request, **context)
# ---------------------------------------------------------------------------
# Vue : création / modification d'une configuration