Blame view

src/pyrosapp/models.py 23.3 KB
509509a8   haribo   Replacing admin.p...
1
2
3
4
5
6
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
#   * Rearrange models' order
#   * Make sure each model has one field with primary_key=True
#   * Make sure each ForeignKey has `on_delete` set to the desired behavior.
#   * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table
94336356   haribo   Added starting fi...
7
8
# Feel free to rename the models, but don't rename db_table values or
# field names.
509509a8   haribo   Replacing admin.p...
9
from __future__ import unicode_literals
c0c999f3   Etienne Pallier   admin : view or e...
10

fde1bc96   haribo   Link User (now Py...
11
from django.contrib.auth.models import User
509509a8   haribo   Replacing admin.p...
12
from django.db import models
c0c999f3   Etienne Pallier   admin : view or e...
13
14


509509a8   haribo   Replacing admin.p...
15
class Album(models.Model):
94336356   haribo   Added starting fi...
16
    sequence = models.ForeignKey(
986d5dec   haribo   Date: 14/06/2016
17
        'Sequence', on_delete=models.CASCADE, related_name="albums")
94336356   haribo   Added starting fi...
18
    detector = models.ForeignKey(
986d5dec   haribo   Date: 14/06/2016
19
        'Detector', models.DO_NOTHING, related_name="albums", blank=True, null=True)
509509a8   haribo   Replacing admin.p...
20
21
    name = models.CharField(max_length=45, blank=True, null=True)
    desc = models.TextField(blank=True, null=True)
6d86da1b   haribo   fix #3400, #3401,...
22
23
    created = models.DateTimeField(blank=True, null=True, auto_now_add=True)
    updated = models.DateTimeField(blank=True, null=True, auto_now=True)
986d5dec   haribo   Date: 14/06/2016
24
    complete = models.BooleanField(default=False)
c0c999f3   Etienne Pallier   admin : view or e...
25

509509a8   haribo   Replacing admin.p...
26
27
28
    class Meta:
        managed = True
        db_table = 'album'
c0c999f3   Etienne Pallier   admin : view or e...
29

509509a8   haribo   Replacing admin.p...
30
31
    def __str__(self):
        return (str(self.name))
c0c999f3   Etienne Pallier   admin : view or e...
32
33


509509a8   haribo   Replacing admin.p...
34
class Alert(models.Model):
986d5dec   haribo   Date: 14/06/2016
35
    request = models.OneToOneField('Request', on_delete=models.CASCADE)
94336356   haribo   Added starting fi...
36
37
    strategyobs = models.ForeignKey(
        'StrategyObs', models.DO_NOTHING, related_name="alerts", blank=True, null=True)
509509a8   haribo   Replacing admin.p...
38
39
40
41
42
43
44
45
46
47
48
49
50
    voevent_xml = models.TextField(blank=True, null=True)
    type = models.CharField(max_length=45, blank=True, null=True)
    client = models.CharField(max_length=45, blank=True, null=True)
    burst_jd = models.CharField(max_length=45, blank=True, null=True)
    burst_ra = models.CharField(max_length=45, blank=True, null=True)
    burst_dec = models.CharField(max_length=45, blank=True, null=True)
    equinox = models.CharField(max_length=45, blank=True, null=True)
    jd_pkt = models.IntegerField(blank=True, null=True)
    jd_send = models.IntegerField(blank=True, null=True)
    jd_received = models.IntegerField(blank=True, null=True)
    trigger_instrum = models.CharField(max_length=45, blank=True, null=True)
    trigger_num = models.CharField(max_length=45, blank=True, null=True)
    grb_error = models.CharField(max_length=45, blank=True, null=True)
3cc75c0f   haribo   other tests
51
    def_not_grb = models.BooleanField(default=False)
509509a8   haribo   Replacing admin.p...
52
53
54
    editor = models.CharField(max_length=45, blank=True, null=True)
    flag = models.CharField(max_length=45, blank=True, null=True)
    idgcn_notice = models.IntegerField(blank=True, null=True)
c0c999f3   Etienne Pallier   admin : view or e...
55

509509a8   haribo   Replacing admin.p...
56
57
58
    class Meta:
        managed = True
        db_table = 'alert'
c0c999f3   Etienne Pallier   admin : view or e...
59

509509a8   haribo   Replacing admin.p...
60
    def __str__(self):
6d86da1b   haribo   fix #3400, #3401,...
61
        return str(self.request.name)
94336356   haribo   Added starting fi...
62

6d86da1b   haribo   fix #3400, #3401,...
63
64
65
    def request_name(self):
        return self.__str__()
    request_name.short_description = "Name"
c0c999f3   Etienne Pallier   admin : view or e...
66

94336356   haribo   Added starting fi...
67

509509a8   haribo   Replacing admin.p...
68
69
70
71
class Country(models.Model):
    name = models.CharField(max_length=45, blank=True, null=True)
    desc = models.TextField(blank=True, null=True)
    quota = models.FloatField(blank=True, null=True)
c0c999f3   Etienne Pallier   admin : view or e...
72

509509a8   haribo   Replacing admin.p...
73
74
75
    class Meta:
        managed = True
        db_table = 'country'
6d86da1b   haribo   fix #3400, #3401,...
76
        verbose_name_plural = "Countries"
c0c999f3   Etienne Pallier   admin : view or e...
77

509509a8   haribo   Replacing admin.p...
78
79
    def __str__(self):
        return (str(self.name))
c0c999f3   Etienne Pallier   admin : view or e...
80
81


509509a8   haribo   Replacing admin.p...
82
class Detector(models.Model):
986d5dec   haribo   Date: 14/06/2016
83
    device = models.OneToOneField('Device', on_delete=models.CASCADE)
94336356   haribo   Added starting fi...
84
85
    telescope = models.ForeignKey(
        'Telescope', models.DO_NOTHING, related_name="detectors")
509509a8   haribo   Replacing admin.p...
86
87
88
89
90
    status = models.CharField(max_length=7, blank=True, null=True)
    nb_photo_x = models.IntegerField(blank=True, null=True)
    nb_photo_y = models.IntegerField(blank=True, null=True)
    photo_size_x = models.IntegerField(blank=True, null=True)
    photo_size_y = models.IntegerField(blank=True, null=True)
3cc75c0f   haribo   other tests
91
    has_shutter = models.BooleanField(default=False)
509509a8   haribo   Replacing admin.p...
92
93
94
95
96
97
98
99
    equivalent_foc_len = models.CharField(max_length=45, blank=True, null=True)
    acq_start = models.DateTimeField(blank=True, null=True)
    acq_stop = models.DateTimeField(blank=True, null=True)
    check_temp = models.FloatField(blank=True, null=True)
    gain = models.FloatField(blank=True, null=True)
    readout_noise = models.FloatField(blank=True, null=True)
    readout_time = models.FloatField(blank=True, null=True)
    idcam_readout_mode = models.IntegerField(blank=True, null=True)
c0c999f3   Etienne Pallier   admin : view or e...
100

509509a8   haribo   Replacing admin.p...
101
102
103
    class Meta:
        managed = True
        db_table = 'detector'
c0c999f3   Etienne Pallier   admin : view or e...
104

509509a8   haribo   Replacing admin.p...
105
    def __str__(self):
6d86da1b   haribo   fix #3400, #3401,...
106
107
108
109
110
        return str(self.device.name)

    def device_name(self):
        return self.__str__()
    device_name.short_description = "Name"
c0c999f3   Etienne Pallier   admin : view or e...
111

94336356   haribo   Added starting fi...
112

509509a8   haribo   Replacing admin.p...
113
class Device(models.Model):
94336356   haribo   Added starting fi...
114
115
116
117
118
119
120
121
122

    TELESCOPE = "Telescope"
    VIS = "Visible camera"
    NIR = "Cagire"
    VIS_FILTER_1 = "First visible filter"
    VIS_FILTER_2 = "Second visible filter"
    NIR_FILTER_1 = "First infrared filter"
    NIR_FILTER_2 = "Second infrared filter"

509509a8   haribo   Replacing admin.p...
123
124
    name = models.CharField(max_length=45, blank=True, null=True)
    desc = models.TextField(blank=True, null=True)
6d86da1b   haribo   fix #3400, #3401,...
125
126
    created = models.DateTimeField(blank=True, null=True, auto_now_add=True)
    updated = models.DateTimeField(blank=True, null=True, auto_now=True)
3cc75c0f   haribo   other tests
127
    is_online = models.BooleanField(default=False)
509509a8   haribo   Replacing admin.p...
128
129
    status = models.CharField(max_length=11, blank=True, null=True)
    maintenance_date = models.DateTimeField(blank=True, null=True)
c0c999f3   Etienne Pallier   admin : view or e...
130

509509a8   haribo   Replacing admin.p...
131
132
133
    class Meta:
        managed = True
        db_table = 'device'
c0c999f3   Etienne Pallier   admin : view or e...
134

509509a8   haribo   Replacing admin.p...
135
136
    def __str__(self):
        return (str(self.name))
c0c999f3   Etienne Pallier   admin : view or e...
137

94336356   haribo   Added starting fi...
138

509509a8   haribo   Replacing admin.p...
139
class Filter(models.Model):
986d5dec   haribo   Date: 14/06/2016
140
    device = models.OneToOneField(Device, on_delete=models.CASCADE)
ec372f36   haribo   Date: 28/06/2016
141
142
    filter_wheel = models.ForeignKey(
        "FilterWheel", models.DO_NOTHING, related_name="filters", blank=True, null=True)
509509a8   haribo   Replacing admin.p...
143
    category = models.CharField(max_length=1, blank=True, null=True)
94336356   haribo   Added starting fi...
144
145
    transmission_curve_doc = models.CharField(
        max_length=45, blank=True, null=True)
c0c999f3   Etienne Pallier   admin : view or e...
146

509509a8   haribo   Replacing admin.p...
147
148
149
    class Meta:
        managed = True
        db_table = 'filter'
c0c999f3   Etienne Pallier   admin : view or e...
150

509509a8   haribo   Replacing admin.p...
151
    def __str__(self):
6d86da1b   haribo   fix #3400, #3401,...
152
        return (str(self.device.name))
c0c999f3   Etienne Pallier   admin : view or e...
153

6d86da1b   haribo   fix #3400, #3401,...
154
155
156
    def device_name(self):
        return self.__str__()
    device_name.short_description = "Name"
ec372f36   haribo   Date: 28/06/2016
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172


class FilterWheel(models.Model):
    device = models.OneToOneField(Device, on_delete=models.CASCADE)
    detector = models.OneToOneField(Detector, on_delete=models.CASCADE, blank=True, null=True)

    class Meta:
        managed = True
        db_table = 'filter_wheel'

    def __str__(self):
        return (str(self.device.name))

    def device_name(self):
        return self.__str__()
    device_name.short_description = "Name"
c0c999f3   Etienne Pallier   admin : view or e...
173

94336356   haribo   Added starting fi...
174

509509a8   haribo   Replacing admin.p...
175
class Image(models.Model):
986d5dec   haribo   Date: 14/06/2016
176
    plan = models.ForeignKey('Plan', on_delete=models.CASCADE, related_name="images")
94336356   haribo   Added starting fi...
177
178
    nrtanalysis = models.ForeignKey(
        'NrtAnalysis', models.DO_NOTHING, blank=True, null=True, related_name="images")
509509a8   haribo   Replacing admin.p...
179
180
    name = models.CharField(max_length=45, blank=True, null=True)
    desc = models.TextField(blank=True, null=True)
6d86da1b   haribo   fix #3400, #3401,...
181
182
    created = models.DateTimeField(blank=True, null=True, auto_now_add=True)
    updated = models.DateTimeField(blank=True, null=True, auto_now=True)
509509a8   haribo   Replacing admin.p...
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
    date_from_gps = models.CharField(max_length=45, blank=True, null=True)
    level = models.IntegerField(blank=True, null=True)
    type = models.CharField(max_length=5, blank=True, null=True)
    quality = models.CharField(max_length=45, blank=True, null=True)
    flaggps = models.CharField(max_length=45, blank=True, null=True)
    exposure = models.CharField(max_length=45, blank=True, null=True)
    tempext = models.CharField(max_length=45, blank=True, null=True)
    pressure = models.CharField(max_length=45, blank=True, null=True)
    humidext = models.CharField(max_length=45, blank=True, null=True)
    wind = models.CharField(max_length=45, blank=True, null=True)
    wind_dir = models.CharField(max_length=45, blank=True, null=True)
    dwnimg = models.CharField(max_length=45, blank=True, null=True)
    dwncata = models.CharField(max_length=45, blank=True, null=True)
    dwn = models.CharField(max_length=45, blank=True, null=True)
    level0_fits_name = models.CharField(max_length=45, blank=True, null=True)
    level1a_fits_name = models.CharField(max_length=45, blank=True, null=True)
    level1b_fits_name = models.CharField(max_length=45, blank=True, null=True)
c0c999f3   Etienne Pallier   admin : view or e...
200

509509a8   haribo   Replacing admin.p...
201
202
203
    class Meta:
        managed = True
        db_table = 'image'
c0c999f3   Etienne Pallier   admin : view or e...
204

509509a8   haribo   Replacing admin.p...
205
206
    def __str__(self):
        return (str(self.name))
c0c999f3   Etienne Pallier   admin : view or e...
207

77816f10   haribo   Workflow implemen...
208
209
210
211
212

class Log(models.Model):
    agent = models.CharField(max_length=45, blank=True, null=True)
    created = models.DateTimeField(blank=True, null=True, auto_now_add=True)
    message = models.TextField(blank=True, null=True)
94336356   haribo   Added starting fi...
213

77816f10   haribo   Workflow implemen...
214
215
    class Meta:
        managed = True
bb45cd4a   haribo   Date: 25/05/2016
216
        db_table = 'log'
77816f10   haribo   Workflow implemen...
217
218
219
220
221

    def __str__(self):
        return (str(self.agent))


509509a8   haribo   Replacing admin.p...
222
223
224
class NrtAnalysis(models.Model):
    name = models.CharField(max_length=45, blank=True, null=True)
    desc = models.TextField(blank=True, null=True)
6d86da1b   haribo   fix #3400, #3401,...
225
226
    created = models.DateTimeField(blank=True, null=True, auto_now_add=True)
    updated = models.DateTimeField(blank=True, null=True, auto_now=True)
509509a8   haribo   Replacing admin.p...
227
    analysis = models.TextField(blank=True, null=True)
c0c999f3   Etienne Pallier   admin : view or e...
228

509509a8   haribo   Replacing admin.p...
229
230
231
    class Meta:
        managed = True
        db_table = 'nrtanalysis'
6d86da1b   haribo   fix #3400, #3401,...
232
        verbose_name_plural = "Nrt analyzes"
c0c999f3   Etienne Pallier   admin : view or e...
233

509509a8   haribo   Replacing admin.p...
234
235
    def __str__(self):
        return (str(self.name))
c0c999f3   Etienne Pallier   admin : view or e...
236
237


509509a8   haribo   Replacing admin.p...
238
class Plan(models.Model):
986d5dec   haribo   Date: 14/06/2016
239
240
    album = models.ForeignKey(Album, on_delete=models.CASCADE, related_name="plans")
    filter = models.ForeignKey(Filter, models.DO_NOTHING, related_name="plans", blank=True, null=True)
509509a8   haribo   Replacing admin.p...
241
242
    name = models.CharField(max_length=45, blank=True, null=True)
    desc = models.CharField(max_length=45, blank=True, null=True)
6d86da1b   haribo   fix #3400, #3401,...
243
244
    created = models.DateTimeField(blank=True, null=True, auto_now_add=True)
    updated = models.DateTimeField(blank=True, null=True, auto_now=True)
986d5dec   haribo   Date: 14/06/2016
245
    duration = models.FloatField(default=0, blank=True, null=True)
509509a8   haribo   Replacing admin.p...
246
247
248
    position = models.CharField(max_length=45, blank=True, null=True)
    exposure_time = models.FloatField(blank=True, null=True)
    nb_images = models.IntegerField(blank=True, null=True)
3cc75c0f   haribo   other tests
249
    dithering = models.BooleanField(default=False)
986d5dec   haribo   Date: 14/06/2016
250
    complete = models.BooleanField(default=False)
c0c999f3   Etienne Pallier   admin : view or e...
251

509509a8   haribo   Replacing admin.p...
252
253
254
    class Meta:
        managed = True
        db_table = 'plan'
c0c999f3   Etienne Pallier   admin : view or e...
255

509509a8   haribo   Replacing admin.p...
256
257
    def __str__(self):
        return (str(self.name))
c0c999f3   Etienne Pallier   admin : view or e...
258
259


6d86da1b   haribo   fix #3400, #3401,...
260
class PyrosUser(models.Model):
986d5dec   haribo   Date: 14/06/2016
261
    user = models.OneToOneField(User, on_delete=models.CASCADE, related_name="pyros_user")
94336356   haribo   Added starting fi...
262
    country = models.ForeignKey(
986d5dec   haribo   Date: 14/06/2016
263
        Country, on_delete=models.DO_NOTHING, related_name="pyros_users")
94082e77   haribo   Date: 03/06/2016
264
    user_level = models.ForeignKey(
986d5dec   haribo   Date: 14/06/2016
265
        'UserLevel', on_delete=models.DO_NOTHING, related_name="pyros_users")
6d86da1b   haribo   fix #3400, #3401,...
266
    desc = models.TextField(blank=True, null=True)
6d86da1b   haribo   fix #3400, #3401,...
267
268
    created = models.DateTimeField(blank=True, null=True, auto_now_add=True)
    updated = models.DateTimeField(blank=True, null=True, auto_now=True)
94082e77   haribo   Date: 03/06/2016
269
270
271
    tel = models.CharField(max_length=45, blank=True, null=True)
    address = models.TextField(max_length=100, blank=True, null=True)
    laboratory = models.CharField(max_length=45, blank=True, null=True)
6d86da1b   haribo   fix #3400, #3401,...
272
273
274
275
276
277
278
279
280
281
282
    last_connect = models.DateTimeField(blank=True, null=True)
    cur_connect = models.DateTimeField(blank=True, null=True)
    putvalid_beg = models.DateTimeField(blank=True, null=True)
    putvalid_end = models.DateTimeField(blank=True, null=True)
    acqvalid_beg = models.CharField(max_length=45, blank=True, null=True)
    acqvalid_end = models.CharField(max_length=45, blank=True, null=True)
    quota = models.FloatField(blank=True, null=True)
    quota_rea = models.FloatField(blank=True, null=True)
    u_priority = models.IntegerField(blank=True, null=True)
    p_priority = models.IntegerField(blank=True, null=True)
    dir_level = models.IntegerField(blank=True, null=True)
3cc75c0f   haribo   other tests
283
    can_del_void_req = models.BooleanField(default=False)
6d86da1b   haribo   fix #3400, #3401,...
284
285
286
287
288
289
290
291
292
293
294
295
296

    class Meta:
        managed = True
        db_table = 'pyros_user'

    def __str__(self):
        return (str(self.user.get_username()))

    def user_username(self):
        return self.__str__()
    user_username.short_description = "Username"


509509a8   haribo   Replacing admin.p...
297
class Request(models.Model):
94336356   haribo   Added starting fi...
298
    pyros_user = models.ForeignKey(
986d5dec   haribo   Date: 14/06/2016
299
        'PyrosUser', on_delete=models.DO_NOTHING, related_name="requests")
94336356   haribo   Added starting fi...
300
    scientific_program = models.ForeignKey(
986d5dec   haribo   Date: 14/06/2016
301
        'ScientificProgram', on_delete=models.DO_NOTHING, related_name="requests", blank=True, null=True)
509509a8   haribo   Replacing admin.p...
302
303
    name = models.CharField(max_length=45, blank=True, null=True)
    desc = models.TextField(blank=True, null=True)
6d86da1b   haribo   fix #3400, #3401,...
304
305
    created = models.DateTimeField(blank=True, null=True, auto_now_add=True)
    updated = models.DateTimeField(blank=True, null=True, auto_now=True)
6d86da1b   haribo   fix #3400, #3401,...
306
    is_alert = models.BooleanField(default=False)
986d5dec   haribo   Date: 14/06/2016
307
    target_type = models.CharField(max_length=8, blank=True, null=True)
509509a8   haribo   Replacing admin.p...
308
    status = models.CharField(max_length=10, blank=True, null=True)
6d86da1b   haribo   fix #3400, #3401,...
309
    autodeposit = models.BooleanField(default=False)
509509a8   haribo   Replacing admin.p...
310
311
    checkpoint = models.CharField(max_length=45, blank=True, null=True)
    flag = models.CharField(max_length=45, blank=True, null=True)
986d5dec   haribo   Date: 14/06/2016
312
    complete = models.BooleanField(default=False)
bbf6e698   haribo   Date: 14/06/2016
313
    submitted = models.BooleanField(default=False)
c0c999f3   Etienne Pallier   admin : view or e...
314

509509a8   haribo   Replacing admin.p...
315
316
317
    class Meta:
        managed = True
        db_table = 'request'
c0c999f3   Etienne Pallier   admin : view or e...
318

509509a8   haribo   Replacing admin.p...
319
320
    def __str__(self):
        return (str(self.name))
c0c999f3   Etienne Pallier   admin : view or e...
321
322


7a79e25b   haribo   Date: 19/05/2016
323
324
325
326
327
328
329
330
331
332
333
334
335
336
# class Schedule(models.Model):
#     created = models.DateTimeField(blank=True, null=True, auto_now_add=True)
#     plan_start = models.DecimalField(
#         default=0.0, max_digits=15, decimal_places=8)
#     plan_end = models.DecimalField(
#         default=0.0, max_digits=15, decimal_places=8)
#     flag = models.CharField(max_length=45, blank=True, null=True)
#
#     class Meta:
#         managed = True
#         db_table = 'schedule'
#
#     def __str__(self):
#         return (str(self.created))
c0c999f3   Etienne Pallier   admin : view or e...
337

c0c999f3   Etienne Pallier   admin : view or e...
338

7a79e25b   haribo   Date: 19/05/2016
339
class Schedule(models.Model):
94336356   haribo   Added starting fi...
340
    sequences = models.ManyToManyField(
7a79e25b   haribo   Date: 19/05/2016
341
        'Sequence', through='ScheduleHasSequences', related_name='schedules')
6d86da1b   haribo   fix #3400, #3401,...
342
    created = models.DateTimeField(blank=True, null=True, auto_now_add=True)
7a79e25b   haribo   Date: 19/05/2016
343
    plan_night_start = models.DecimalField(
94336356   haribo   Added starting fi...
344
345
346
        default=0.0, max_digits=15, decimal_places=8)
    plan_end = models.DecimalField(
        default=0.0, max_digits=15, decimal_places=8)
7a79e25b   haribo   Date: 19/05/2016
347
348
    plan_start = models.DecimalField(
        default=0.0, max_digits=15, decimal_places=8)
509509a8   haribo   Replacing admin.p...
349
    flag = models.CharField(max_length=45, blank=True, null=True)
c0c999f3   Etienne Pallier   admin : view or e...
350

509509a8   haribo   Replacing admin.p...
351
352
    class Meta:
        managed = True
7a79e25b   haribo   Date: 19/05/2016
353
354
        db_table = 'schedule'
        verbose_name_plural = "Schedules"
c0c999f3   Etienne Pallier   admin : view or e...
355

509509a8   haribo   Replacing admin.p...
356
357
    def __str__(self):
        return (str(self.created))
c0c999f3   Etienne Pallier   admin : view or e...
358
359


509509a8   haribo   Replacing admin.p...
360
class ScientificProgram(models.Model):
94336356   haribo   Added starting fi...
361
362
    pyros_users = models.ManyToManyField(
        'PyrosUser', related_name="scientific_programs")
509509a8   haribo   Replacing admin.p...
363
364
365
366
    name = models.CharField(max_length=45, blank=True, null=True)
    desc = models.TextField(blank=True, null=True)
    quota = models.FloatField(blank=True, null=True)
    priority = models.IntegerField(blank=True, null=True)
c0c999f3   Etienne Pallier   admin : view or e...
367

509509a8   haribo   Replacing admin.p...
368
369
    class Meta:
        managed = True
94336356   haribo   Added starting fi...
370
        db_table = 'scientific_program'
c0c999f3   Etienne Pallier   admin : view or e...
371

509509a8   haribo   Replacing admin.p...
372
373
    def __str__(self):
        return (str(self.name))
c0c999f3   Etienne Pallier   admin : view or e...
374

94336356   haribo   Added starting fi...
375

509509a8   haribo   Replacing admin.p...
376
class Sequence(models.Model):
94336356   haribo   Added starting fi...
377

06241f05   haribo   Class scheduler f...
378
    """ Definition of Status enum values """
94336356   haribo   Added starting fi...
379

986d5dec   haribo   Date: 14/06/2016
380
    INCOMPLETE = "INCPL"
bbf6e698   haribo   Date: 14/06/2016
381
    COMPLETE = "CPL"
06241f05   haribo   Class scheduler f...
382
383
384
    TOBEPLANNED = "TBP"
    OBSERVABLE = "OBS"
    UNPLANNABLE = "UNPLN"
eecfb779   haribo   Date: 26/05/2016
385
    PENDING = "PNDG"
06241f05   haribo   Class scheduler f...
386
    EXECUTED = "EXD"
7a79e25b   haribo   Date: 19/05/2016
387
    EXECUTING = "EXING"
06241f05   haribo   Class scheduler f...
388
    REJECTED = "RJTD"
bb45cd4a   haribo   Date: 25/05/2016
389
    CANCELLED = "CNCLD"
b87b6d9b   haribo   Finished tests fo...
390
    INVALID = "INVL"
06241f05   haribo   Class scheduler f...
391
    STATUS_CHOICES = (
bbf6e698   haribo   Date: 14/06/2016
392
393
        (INCOMPLETE, "Incomplete"),
        (COMPLETE, "Complete"),
06241f05   haribo   Class scheduler f...
394
395
396
        (TOBEPLANNED, "To be planned"),
        (OBSERVABLE, "Observable"),
        (UNPLANNABLE, "Unplannable"),
bb45cd4a   haribo   Date: 25/05/2016
397
        (PENDING, "Pending"),
06241f05   haribo   Class scheduler f...
398
        (EXECUTED, "Executed"),
7a79e25b   haribo   Date: 19/05/2016
399
        (EXECUTING, "Executing"),
b87b6d9b   haribo   Finished tests fo...
400
        (REJECTED, "Rejected"),
bb45cd4a   haribo   Date: 25/05/2016
401
        (CANCELLED, "Cancelled"),
b87b6d9b   haribo   Finished tests fo...
402
        (INVALID, "Invalid"),
06241f05   haribo   Class scheduler f...
403
    )
94336356   haribo   Added starting fi...
404
405

    request = models.ForeignKey(
986d5dec   haribo   Date: 14/06/2016
406
        Request, on_delete=models.CASCADE, related_name="sequences")
509509a8   haribo   Replacing admin.p...
407
408
    name = models.CharField(max_length=45, blank=True, null=True)
    desc = models.TextField(blank=True, null=True)
6d86da1b   haribo   fix #3400, #3401,...
409
410
    created = models.DateTimeField(blank=True, null=True, auto_now_add=True)
    updated = models.DateTimeField(blank=True, null=True, auto_now=True)
3cc75c0f   haribo   other tests
411
    is_alert = models.BooleanField(default=False)
94336356   haribo   Added starting fi...
412
413
    status = models.CharField(
        max_length=11, blank=True, null=True, choices=STATUS_CHOICES)
986d5dec   haribo   Date: 14/06/2016
414
    target_coords = models.CharField(max_length=100, blank=True, null=True)
3cc75c0f   haribo   other tests
415
    with_drift = models.BooleanField(default=False)
509509a8   haribo   Replacing admin.p...
416
417
    priority = models.IntegerField(blank=True, null=True)
    analysis_method = models.CharField(max_length=45, blank=True, null=True)
509509a8   haribo   Replacing admin.p...
418
419
420
421
422
    moon_min = models.IntegerField(blank=True, null=True)
    alt_min = models.IntegerField(blank=True, null=True)
    type = models.CharField(max_length=6, blank=True, null=True)
    img_current = models.CharField(max_length=45, blank=True, null=True)
    img_total = models.CharField(max_length=45, blank=True, null=True)
3cc75c0f   haribo   other tests
423
    not_obs = models.BooleanField(default=False)
6d86da1b   haribo   fix #3400, #3401,...
424
425
    obsolete = models.BooleanField(default=False)
    processing = models.BooleanField(default=False)
509509a8   haribo   Replacing admin.p...
426
    flag = models.CharField(max_length=45, blank=True, null=True)
06241f05   haribo   Class scheduler f...
427
428
    jd1 = models.DecimalField(default=0.0, max_digits=15, decimal_places=8)
    jd2 = models.DecimalField(default=0.0, max_digits=15, decimal_places=8)
94336356   haribo   Added starting fi...
429
430
431
432
    t_prefered = models.DecimalField(
        default=-1.0, max_digits=15, decimal_places=8)
    duration = models.DecimalField(
        default=-1.0, max_digits=15, decimal_places=8)
a046fe99   haribo   Message at the en...
433
    overhead = models.DecimalField(default=0, max_digits=15, decimal_places=8)
3cc75c0f   haribo   other tests
434

509509a8   haribo   Replacing admin.p...
435
436
437
    class Meta:
        managed = True
        db_table = 'sequence'
c0c999f3   Etienne Pallier   admin : view or e...
438

509509a8   haribo   Replacing admin.p...
439
440
    def __str__(self):
        return (str(self.name))
c0c999f3   Etienne Pallier   admin : view or e...
441
442


7a79e25b   haribo   Date: 19/05/2016
443
444
class ScheduleHasSequences(models.Model):
    schedule = models.ForeignKey(
986d5dec   haribo   Date: 14/06/2016
445
        'Schedule', on_delete=models.CASCADE, related_name="shs")
7a79e25b   haribo   Date: 19/05/2016
446
    sequence = models.ForeignKey(
986d5dec   haribo   Date: 14/06/2016
447
        'Sequence', on_delete=models.CASCADE, related_name="shs")
7a79e25b   haribo   Date: 19/05/2016
448
449
450

    status = models.CharField(
        max_length=11, blank=True, null=True, choices=Sequence.STATUS_CHOICES)
eecfb779   haribo   Date: 26/05/2016
451
    desc = models.CharField(max_length=45, blank=True, null=True)
7a79e25b   haribo   Date: 19/05/2016
452
453
454
455
456
457
458
459
460
461
462
463
    tsp = models.DecimalField(default=-1.0, max_digits=15, decimal_places=8)
    tep = models.DecimalField(default=-1.0, max_digits=15, decimal_places=8)
    deltaTL = models.DecimalField(
        default=-1.0, max_digits=15, decimal_places=8)
    deltaTR = models.DecimalField(
        default=-1.0, max_digits=15, decimal_places=8)

    class Meta:
        managed = True
        db_table = 'schedule_has_sequences'


509509a8   haribo   Replacing admin.p...
464
class SiteWatch(models.Model):
6d86da1b   haribo   fix #3400, #3401,...
465
    updated = models.DateTimeField(blank=True, null=True, auto_now=True)
509509a8   haribo   Replacing admin.p...
466
467
468
469
    lights = models.CharField(max_length=45, blank=True, null=True)
    dome = models.CharField(max_length=45, blank=True, null=True)
    doors = models.CharField(max_length=45, blank=True, null=True)
    temperature = models.FloatField(blank=True, null=True)
c0c999f3   Etienne Pallier   admin : view or e...
470

509509a8   haribo   Replacing admin.p...
471
472
473
    class Meta:
        managed = True
        db_table = 'sitewatch'
6d86da1b   haribo   fix #3400, #3401,...
474
        verbose_name_plural = "Site watches"
c0c999f3   Etienne Pallier   admin : view or e...
475

509509a8   haribo   Replacing admin.p...
476
477
    def __str__(self):
        return (str(self.updated))
c0c999f3   Etienne Pallier   admin : view or e...
478
479


509509a8   haribo   Replacing admin.p...
480
481
class SiteWatchHistory(models.Model):
    id = models.IntegerField(primary_key=True)
c0c999f3   Etienne Pallier   admin : view or e...
482

509509a8   haribo   Replacing admin.p...
483
484
485
    class Meta:
        managed = True
        db_table = 'sitewatchhistory'
6d86da1b   haribo   fix #3400, #3401,...
486
        verbose_name_plural = "Site watch histories"
c0c999f3   Etienne Pallier   admin : view or e...
487
488


509509a8   haribo   Replacing admin.p...
489
490
491
class StrategyObs(models.Model):
    name = models.CharField(max_length=45, blank=True, null=True)
    desc = models.TextField(blank=True, null=True)
bb45cd4a   haribo   Date: 25/05/2016
492
    xml_file = models.CharField(max_length=45, blank=True, null=True)
c0c999f3   Etienne Pallier   admin : view or e...
493

509509a8   haribo   Replacing admin.p...
494
495
496
    class Meta:
        managed = True
        db_table = 'strategyobs'
6d86da1b   haribo   fix #3400, #3401,...
497
        verbose_name_plural = "Strategy obs"
c0c999f3   Etienne Pallier   admin : view or e...
498

509509a8   haribo   Replacing admin.p...
499
500
    def __str__(self):
        return (str(self.name))
c0c999f3   Etienne Pallier   admin : view or e...
501
502


bb45cd4a   haribo   Date: 25/05/2016
503
504
505
506
507
508
509
510
511
512
513
514
515
class TaskId(models.Model):
    task = models.CharField(max_length=45, blank=True, null=True)
    created = models.DateTimeField(blank=True, null=True, auto_now_add=True)
    task_id = models.CharField(max_length=45, blank=True, null=True)

    class Meta:
        managed = True
        db_table = 'task_id'

    def __str__(self):
        return (str(self.task) + " - " + str(self.task_id))


509509a8   haribo   Replacing admin.p...
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
class Telescope(models.Model):
    device = models.OneToOneField(Device, models.CASCADE)
    mount_type = models.CharField(max_length=9, blank=True, null=True)
    diameter = models.FloatField(blank=True, null=True)
    status = models.CharField(max_length=45, blank=True, null=True)
    latitude = models.FloatField(blank=True, null=True)
    longitude = models.FloatField(blank=True, null=True)
    sens = models.CharField(max_length=1, blank=True, null=True)
    altitude = models.FloatField(blank=True, null=True)
    readout_time = models.IntegerField(blank=True, null=True)
    slew_time = models.IntegerField(blank=True, null=True)
    slew_dead = models.IntegerField(blank=True, null=True)
    slew_rate_max = models.FloatField(blank=True, null=True)
    horizon_type = models.CharField(max_length=45, blank=True, null=True)
    horizon_def = models.FloatField(blank=True, null=True)
    lim_dec_max = models.FloatField(blank=True, null=True)
    lim_dec_min = models.FloatField(blank=True, null=True)
    lim_ha_rise = models.FloatField(blank=True, null=True)
    lim_ha_set = models.FloatField(blank=True, null=True)
    address = models.CharField(max_length=45, blank=True, null=True)
    night_elev_sun = models.FloatField(blank=True, null=True)
    mpc_code = models.CharField(max_length=45, blank=True, null=True)
c0c999f3   Etienne Pallier   admin : view or e...
538

509509a8   haribo   Replacing admin.p...
539
540
541
    class Meta:
        managed = True
        db_table = 'telescope'
c0c999f3   Etienne Pallier   admin : view or e...
542

509509a8   haribo   Replacing admin.p...
543
544
    def __str__(self):
        return (self.device.name)
c0c999f3   Etienne Pallier   admin : view or e...
545
546


509509a8   haribo   Replacing admin.p...
547
548
549
550
551
class UserLevel(models.Model):
    name = models.CharField(max_length=45, blank=True, null=True)
    desc = models.TextField(blank=True, null=True)
    priority = models.IntegerField(blank=True, null=True)
    quota = models.FloatField(blank=True, null=True)
c0c999f3   Etienne Pallier   admin : view or e...
552

509509a8   haribo   Replacing admin.p...
553
554
    class Meta:
        managed = True
94082e77   haribo   Date: 03/06/2016
555
        db_table = 'user_level'
c0c999f3   Etienne Pallier   admin : view or e...
556

509509a8   haribo   Replacing admin.p...
557
558
    def __str__(self):
        return (str(self.name))
c0c999f3   Etienne Pallier   admin : view or e...
559
560


9f81217f   haribo   Date: 22/06/2016
561
562
563
564
565
566
567
568
569
570
571
572
573
class Version(models.Model):
    module_name = models.CharField(max_length=45, blank=True, null=True)
    version = models.CharField(max_length=15, blank=True, null=True)
    created = models.DateTimeField(blank=True, null=True, auto_now_add=True)
    updated = models.DateTimeField(blank=True, null=True, auto_now=True)

    class Meta:
        managed = True
        db_table = 'version'

    def __str__(self):
        return (str(self.module_name) + " - " + str(self.version))

509509a8   haribo   Replacing admin.p...
574
575
576
577
578
579
580
581
582
583
584
class WeatherWatch(models.Model):
    updated = models.DateTimeField(blank=True, null=True)
    humid_int = models.FloatField(blank=True, null=True)
    humid_ext = models.FloatField(blank=True, null=True)
    wind = models.FloatField(blank=True, null=True)
    wind_dir = models.CharField(max_length=1, blank=True, null=True)
    temp_int = models.FloatField(blank=True, null=True)
    temp_ext = models.FloatField(blank=True, null=True)
    pressure = models.FloatField(blank=True, null=True)
    rain = models.FloatField(blank=True, null=True)
    dwn = models.CharField(max_length=45, blank=True, null=True)
c0c999f3   Etienne Pallier   admin : view or e...
585

509509a8   haribo   Replacing admin.p...
586
587
588
    class Meta:
        managed = True
        db_table = 'weatherwatch'
6d86da1b   haribo   fix #3400, #3401,...
589
        verbose_name_plural = "Weather watches"
c0c999f3   Etienne Pallier   admin : view or e...
590

509509a8   haribo   Replacing admin.p...
591
592
    def __str__(self):
        return (str(self.updated))
c0c999f3   Etienne Pallier   admin : view or e...
593
594


509509a8   haribo   Replacing admin.p...
595
class WeatherWatchHistory(models.Model):
6d86da1b   haribo   fix #3400, #3401,...
596
    datetime = models.DateTimeField(blank=True, null=True, auto_now_add=True)
509509a8   haribo   Replacing admin.p...
597
598
599
600
601
602
603
604
605
    humid_int = models.CharField(max_length=45, blank=True, null=True)
    humid_ext = models.CharField(max_length=45, blank=True, null=True)
    wind = models.CharField(max_length=45, blank=True, null=True)
    wind_dir = models.CharField(max_length=45, blank=True, null=True)
    temp_int = models.CharField(max_length=45, blank=True, null=True)
    temp_ext = models.CharField(max_length=45, blank=True, null=True)
    pressure = models.CharField(max_length=45, blank=True, null=True)
    rain = models.CharField(max_length=45, blank=True, null=True)
    dwn = models.CharField(max_length=45, blank=True, null=True)
c0c999f3   Etienne Pallier   admin : view or e...
606

509509a8   haribo   Replacing admin.p...
607
608
609
    class Meta:
        managed = True
        db_table = 'weatherwatchhistory'
6d86da1b   haribo   fix #3400, #3401,...
610
        verbose_name_plural = "Weather watch histories"
c0c999f3   Etienne Pallier   admin : view or e...
611

509509a8   haribo   Replacing admin.p...
612
613
    def __str__(self):
        return (str(self.datetime))