File size: 951 Bytes
4464a90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from django.db import models


class Simulation(models.Model):
    STATUS_CHOICES = [
        ('pending', 'En attente'),
        ('running', 'En cours'),
        ('completed', 'Terminée'),
        ('failed', 'Échouée'),
    ]
    
    name = models.CharField(max_length=255, blank=True)
    parameters = models.JSONField(default=dict)
    status = models.CharField(max_length=20, choices=STATUS_CHOICES, default='pending')
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)
    completed_at = models.DateTimeField(null=True, blank=True)
    
    result_summary = models.JSONField(null=True, blank=True)
    result_file_path = models.CharField(max_length=500, blank=True)
    result_image_path = models.CharField(max_length=500, blank=True)
    
    error_message = models.TextField(blank=True)
    
    def __str__(self):
        return f"Simulation #{self.id} - {self.name or 'Sans nom'}"