|
@@
-2,9
+2,16
from itertools import chain
|
|
2
|
from django.db import models
|
|
2
|
from django.db import models
|
|
3
|
from polymorphic import PolymorphicModel
|
|
3
|
from polymorphic import PolymorphicModel
|
|
4
|
|
|
4
|
|
|
5
|
STATES = (
|
|
5
|
CONF_STATES = (
|
|
6
|
(0, 'Inactive'),
|
|
6
|
(0, 'Active'),
|
|
7
|
(1, 'Active'),
|
|
7
|
(1, 'Historial'),
|
|
|
|
|
8
|
)
|
|
|
|
|
9
|
|
|
|
|
|
10
|
DEV_STATES = (
|
|
|
|
|
11
|
(0, 'No connected'),
|
|
|
|
|
12
|
(1, 'Connected'),
|
|
|
|
|
13
|
(2, 'Configured'),
|
|
|
|
|
14
|
(3, 'Running'),
|
|
8
|
)
|
|
15
|
)
|
|
9
|
|
|
16
|
|
|
10
|
DEV_TYPES = (
|
|
17
|
DEV_TYPES = (
|
|
@@
-41,10
+48,11
class Device(models.Model):
|
|
41
|
ip_address = models.GenericIPAddressField(protocol='IPv4', default='0.0.0.0')
|
|
48
|
ip_address = models.GenericIPAddressField(protocol='IPv4', default='0.0.0.0')
|
|
42
|
port_address = models.PositiveSmallIntegerField(default=2000)
|
|
49
|
port_address = models.PositiveSmallIntegerField(default=2000)
|
|
43
|
description = models.TextField(blank=True, null=True)
|
|
50
|
description = models.TextField(blank=True, null=True)
|
|
|
|
|
51
|
status = models.PositiveSmallIntegerField(default=0, choices=DEV_STATES)
|
|
44
|
|
|
52
|
|
|
45
|
# serial_number = models.CharField(max_length=40, default='')
|
|
53
|
# serial_number = models.CharField(max_length=40, default='')
|
|
46
|
# mac_address = models.CharField(max_length = 20, null=True, blank=True)
|
|
54
|
# mac_address = models.CharField(max_length = 20, null=True, blank=True)
|
|
47
|
# status = models.PositiveSmallIntegerField(default=1, choices=STATES)
|
|
55
|
|
|
48
|
|
|
56
|
|
|
49
|
class Meta:
|
|
57
|
class Meta:
|
|
50
|
db_table = 'db_devices'
|
|
58
|
db_table = 'db_devices'
|
|
@@
-84,9
+92,10
class Configuration(PolymorphicModel):
|
|
84
|
|
|
92
|
|
|
85
|
experiment = models.ForeignKey(Experiment)
|
|
93
|
experiment = models.ForeignKey(Experiment)
|
|
86
|
device = models.ForeignKey(Device)
|
|
94
|
device = models.ForeignKey(Device)
|
|
|
|
|
95
|
status = models.PositiveSmallIntegerField(default=0, choices=CONF_STATES)
|
|
|
|
|
96
|
date = models.DateTimeField(auto_now=True, blank=True)
|
|
|
|
|
97
|
|
|
87
|
# parameters = models.TextField(default='{}')
|
|
98
|
# parameters = models.TextField(default='{}')
|
|
88
|
# status = models.PositiveSmallIntegerField(default=1, choices=STATES)
|
|
|
|
|
89
|
|
|
|
|
|
90
|
class Meta:
|
|
99
|
class Meta:
|
|
91
|
db_table = 'db_configurations'
|
|
100
|
db_table = 'db_configurations'
|
|
92
|
|
|
101
|
|