Blame view

src/pyrosapp/models.py 22 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
17
18
19
    sequence = models.ForeignKey(
        'Sequence', models.CASCADE, related_name="albums")
    detector = models.ForeignKey(
        'Detector', models.DO_NOTHING, related_name="albums")
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)
c0c999f3   Etienne Pallier   admin : view or e...
24

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

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


509509a8   haribo   Replacing admin.p...
33
34
class Alert(models.Model):
    request = models.OneToOneField('Request', models.CASCADE)
94336356   haribo   Added starting fi...
35
36
    strategyobs = models.ForeignKey(
        'StrategyObs', models.DO_NOTHING, related_name="alerts", blank=True, null=True)
509509a8   haribo   Replacing admin.p...
37
38
39
40
41
42
43
44
45
46
47
48
49
    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
50
    def_not_grb = models.BooleanField(default=False)
509509a8   haribo   Replacing admin.p...
51
52
53
    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...
54

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

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

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

94336356   haribo   Added starting fi...
66

509509a8   haribo   Replacing admin.p...
67
68
69
70
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...
71

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

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


509509a8   haribo   Replacing admin.p...
81
82
class Detector(models.Model):
    device = models.OneToOneField('Device', models.CASCADE)
94336356   haribo   Added starting fi...
83
84
    telescope = models.ForeignKey(
        'Telescope', models.DO_NOTHING, related_name="detectors")
509509a8   haribo   Replacing admin.p...
85
86
87
88
89
    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
90
    has_shutter = models.BooleanField(default=False)
509509a8   haribo   Replacing admin.p...
91
92
93
94
95
96
97
98
    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...
99

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

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

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

94336356   haribo   Added starting fi...
111

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

    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...
122
123
    name = models.CharField(max_length=45, blank=True, null=True)
    desc = models.TextField(blank=True, null=True)
6d86da1b   haribo   fix #3400, #3401,...
124
125
    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
126
    is_online = models.BooleanField(default=False)
509509a8   haribo   Replacing admin.p...
127
128
    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...
129

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

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

94336356   haribo   Added starting fi...
137

509509a8   haribo   Replacing admin.p...
138
139
class Filter(models.Model):
    device = models.OneToOneField(Device, models.CASCADE)
94336356   haribo   Added starting fi...
140
141
    detector = models.ForeignKey(
        Detector, models.DO_NOTHING, related_name="filters")
509509a8   haribo   Replacing admin.p...
142
    category = models.CharField(max_length=1, blank=True, null=True)
94336356   haribo   Added starting fi...
143
144
    transmission_curve_doc = models.CharField(
        max_length=45, blank=True, null=True)
c0c999f3   Etienne Pallier   admin : view or e...
145

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

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

6d86da1b   haribo   fix #3400, #3401,...
153
154
155
    def device_name(self):
        return self.__str__()
    device_name.short_description = "Name"
c0c999f3   Etienne Pallier   admin : view or e...
156

94336356   haribo   Added starting fi...
157

509509a8   haribo   Replacing admin.p...
158
159
class Image(models.Model):
    plan = models.ForeignKey('Plan', models.CASCADE, related_name="images")
94336356   haribo   Added starting fi...
160
161
    nrtanalysis = models.ForeignKey(
        'NrtAnalysis', models.DO_NOTHING, blank=True, null=True, related_name="images")
509509a8   haribo   Replacing admin.p...
162
163
    name = models.CharField(max_length=45, blank=True, null=True)
    desc = models.TextField(blank=True, null=True)
6d86da1b   haribo   fix #3400, #3401,...
164
165
    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...
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
    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...
183

509509a8   haribo   Replacing admin.p...
184
185
186
    class Meta:
        managed = True
        db_table = 'image'
c0c999f3   Etienne Pallier   admin : view or e...
187

509509a8   haribo   Replacing admin.p...
188
189
    def __str__(self):
        return (str(self.name))
c0c999f3   Etienne Pallier   admin : view or e...
190

77816f10   haribo   Workflow implemen...
191
192
193
194
195

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...
196

77816f10   haribo   Workflow implemen...
197
198
    class Meta:
        managed = True
bb45cd4a   haribo   Date: 25/05/2016
199
        db_table = 'log'
77816f10   haribo   Workflow implemen...
200
201
202
203
204

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


509509a8   haribo   Replacing admin.p...
205
206
207
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,...
208
209
    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...
210
    analysis = models.TextField(blank=True, null=True)
c0c999f3   Etienne Pallier   admin : view or e...
211

509509a8   haribo   Replacing admin.p...
212
213
214
    class Meta:
        managed = True
        db_table = 'nrtanalysis'
6d86da1b   haribo   fix #3400, #3401,...
215
        verbose_name_plural = "Nrt analyzes"
c0c999f3   Etienne Pallier   admin : view or e...
216

509509a8   haribo   Replacing admin.p...
217
218
    def __str__(self):
        return (str(self.name))
c0c999f3   Etienne Pallier   admin : view or e...
219
220


509509a8   haribo   Replacing admin.p...
221
222
223
224
225
class Plan(models.Model):
    album = models.ForeignKey(Album, models.CASCADE, related_name="plans")
    filter = models.ForeignKey(Filter, models.DO_NOTHING, related_name="plans")
    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,...
226
227
    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...
228
229
230
231
    duration = models.FloatField(blank=True, null=True)
    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
232
    dithering = models.BooleanField(default=False)
c0c999f3   Etienne Pallier   admin : view or e...
233

509509a8   haribo   Replacing admin.p...
234
235
236
    class Meta:
        managed = True
        db_table = 'plan'
c0c999f3   Etienne Pallier   admin : view or e...
237

509509a8   haribo   Replacing admin.p...
238
239
    def __str__(self):
        return (str(self.name))
c0c999f3   Etienne Pallier   admin : view or e...
240
241


6d86da1b   haribo   fix #3400, #3401,...
242
243
class PyrosUser(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE)
94336356   haribo   Added starting fi...
244
245
    country = models.ForeignKey(
        Country, models.DO_NOTHING, related_name="pyros_users")
94082e77   haribo   Date: 03/06/2016
246
    user_level = models.ForeignKey(
94336356   haribo   Added starting fi...
247
        'UserLevel', models.DO_NOTHING, related_name="pyros_users")
6d86da1b   haribo   fix #3400, #3401,...
248
    desc = models.TextField(blank=True, null=True)
6d86da1b   haribo   fix #3400, #3401,...
249
250
    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
251
252
253
    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,...
254
255
256
257
258
259
260
261
262
263
264
    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
265
    can_del_void_req = models.BooleanField(default=False)
6d86da1b   haribo   fix #3400, #3401,...
266
267
268
269
270
271
272
273
274
275
276
277
278

    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...
279
class Request(models.Model):
94336356   haribo   Added starting fi...
280
281
282
283
    pyros_user = models.ForeignKey(
        'PyrosUser', models.DO_NOTHING, related_name="requests")
    scientific_program = models.ForeignKey(
        'ScientificProgram', models.DO_NOTHING, related_name="requests")
509509a8   haribo   Replacing admin.p...
284
285
    name = models.CharField(max_length=45, blank=True, null=True)
    desc = models.TextField(blank=True, null=True)
6d86da1b   haribo   fix #3400, #3401,...
286
287
    created = models.DateTimeField(blank=True, null=True, auto_now_add=True)
    updated = models.DateTimeField(blank=True, null=True, auto_now=True)
bb45cd4a   haribo   Date: 25/05/2016
288
    # is_alert = models.IntegerField(blank=True, null=True)
6d86da1b   haribo   fix #3400, #3401,...
289
    is_alert = models.BooleanField(default=False)
509509a8   haribo   Replacing admin.p...
290
291
292
293
    type = models.CharField(max_length=8, blank=True, null=True)
    status = models.CharField(max_length=10, blank=True, null=True)
    target_or_theme = models.CharField(max_length=45, blank=True, null=True)
    priority = models.IntegerField(blank=True, null=True)
6d86da1b   haribo   fix #3400, #3401,...
294
    autodeposit = models.BooleanField(default=False)
509509a8   haribo   Replacing admin.p...
295
296
    checkpoint = models.CharField(max_length=45, blank=True, null=True)
    flag = models.CharField(max_length=45, blank=True, null=True)
c0c999f3   Etienne Pallier   admin : view or e...
297

509509a8   haribo   Replacing admin.p...
298
299
300
    class Meta:
        managed = True
        db_table = 'request'
c0c999f3   Etienne Pallier   admin : view or e...
301

509509a8   haribo   Replacing admin.p...
302
303
    def __str__(self):
        return (str(self.name))
c0c999f3   Etienne Pallier   admin : view or e...
304
305


7a79e25b   haribo   Date: 19/05/2016
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# 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...
320

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

7a79e25b   haribo   Date: 19/05/2016
322
class Schedule(models.Model):
94336356   haribo   Added starting fi...
323
    sequences = models.ManyToManyField(
7a79e25b   haribo   Date: 19/05/2016
324
        'Sequence', through='ScheduleHasSequences', related_name='schedules')
6d86da1b   haribo   fix #3400, #3401,...
325
    created = models.DateTimeField(blank=True, null=True, auto_now_add=True)
7a79e25b   haribo   Date: 19/05/2016
326
    plan_night_start = models.DecimalField(
94336356   haribo   Added starting fi...
327
328
329
        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
330
331
    plan_start = models.DecimalField(
        default=0.0, max_digits=15, decimal_places=8)
509509a8   haribo   Replacing admin.p...
332
    flag = models.CharField(max_length=45, blank=True, null=True)
c0c999f3   Etienne Pallier   admin : view or e...
333

509509a8   haribo   Replacing admin.p...
334
335
    class Meta:
        managed = True
7a79e25b   haribo   Date: 19/05/2016
336
337
        db_table = 'schedule'
        verbose_name_plural = "Schedules"
c0c999f3   Etienne Pallier   admin : view or e...
338

509509a8   haribo   Replacing admin.p...
339
340
    def __str__(self):
        return (str(self.created))
c0c999f3   Etienne Pallier   admin : view or e...
341
342


509509a8   haribo   Replacing admin.p...
343
class ScientificProgram(models.Model):
94336356   haribo   Added starting fi...
344
345
    pyros_users = models.ManyToManyField(
        'PyrosUser', related_name="scientific_programs")
509509a8   haribo   Replacing admin.p...
346
347
348
349
    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...
350

509509a8   haribo   Replacing admin.p...
351
352
    class Meta:
        managed = True
94336356   haribo   Added starting fi...
353
        db_table = 'scientific_program'
c0c999f3   Etienne Pallier   admin : view or e...
354

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

94336356   haribo   Added starting fi...
358

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

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

06241f05   haribo   Class scheduler f...
363
364
365
    TOBEPLANNED = "TBP"
    OBSERVABLE = "OBS"
    UNPLANNABLE = "UNPLN"
eecfb779   haribo   Date: 26/05/2016
366
    PENDING = "PNDG"
06241f05   haribo   Class scheduler f...
367
    EXECUTED = "EXD"
7a79e25b   haribo   Date: 19/05/2016
368
    EXECUTING = "EXING"
06241f05   haribo   Class scheduler f...
369
    REJECTED = "RJTD"
bb45cd4a   haribo   Date: 25/05/2016
370
    CANCELLED = "CNCLD"
b87b6d9b   haribo   Finished tests fo...
371
    INVALID = "INVL"
06241f05   haribo   Class scheduler f...
372
373
374
375
    STATUS_CHOICES = (
        (TOBEPLANNED, "To be planned"),
        (OBSERVABLE, "Observable"),
        (UNPLANNABLE, "Unplannable"),
bb45cd4a   haribo   Date: 25/05/2016
376
        (PENDING, "Pending"),
06241f05   haribo   Class scheduler f...
377
        (EXECUTED, "Executed"),
7a79e25b   haribo   Date: 19/05/2016
378
        (EXECUTING, "Executing"),
b87b6d9b   haribo   Finished tests fo...
379
        (REJECTED, "Rejected"),
bb45cd4a   haribo   Date: 25/05/2016
380
        (CANCELLED, "Cancelled"),
b87b6d9b   haribo   Finished tests fo...
381
        (INVALID, "Invalid"),
06241f05   haribo   Class scheduler f...
382
    )
94336356   haribo   Added starting fi...
383
384
385

    request = models.ForeignKey(
        Request, models.CASCADE, related_name="sequences")
509509a8   haribo   Replacing admin.p...
386
387
    name = models.CharField(max_length=45, blank=True, null=True)
    desc = models.TextField(blank=True, null=True)
6d86da1b   haribo   fix #3400, #3401,...
388
389
    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
390
    is_alert = models.BooleanField(default=False)
94336356   haribo   Added starting fi...
391
392
    status = models.CharField(
        max_length=11, blank=True, null=True, choices=STATUS_CHOICES)
509509a8   haribo   Replacing admin.p...
393
    pointing = models.CharField(max_length=45, blank=True, null=True)
3cc75c0f   haribo   other tests
394
    with_drift = models.BooleanField(default=False)
509509a8   haribo   Replacing admin.p...
395
396
    priority = models.IntegerField(blank=True, null=True)
    analysis_method = models.CharField(max_length=45, blank=True, null=True)
509509a8   haribo   Replacing admin.p...
397
398
399
400
401
    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
402
    not_obs = models.BooleanField(default=False)
6d86da1b   haribo   fix #3400, #3401,...
403
404
    obsolete = models.BooleanField(default=False)
    processing = models.BooleanField(default=False)
509509a8   haribo   Replacing admin.p...
405
    flag = models.CharField(max_length=45, blank=True, null=True)
06241f05   haribo   Class scheduler f...
406
407
    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...
408
409
410
411
    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...
412
    overhead = models.DecimalField(default=0, max_digits=15, decimal_places=8)
3cc75c0f   haribo   other tests
413

509509a8   haribo   Replacing admin.p...
414
415
416
    class Meta:
        managed = True
        db_table = 'sequence'
c0c999f3   Etienne Pallier   admin : view or e...
417

509509a8   haribo   Replacing admin.p...
418
419
    def __str__(self):
        return (str(self.name))
c0c999f3   Etienne Pallier   admin : view or e...
420
421


7a79e25b   haribo   Date: 19/05/2016
422
423
424
425
426
427
428
429
class ScheduleHasSequences(models.Model):
    schedule = models.ForeignKey(
        'Schedule', models.DO_NOTHING, related_name="shs")
    sequence = models.ForeignKey(
        'Sequence', models.DO_NOTHING, related_name="shs")

    status = models.CharField(
        max_length=11, blank=True, null=True, choices=Sequence.STATUS_CHOICES)
eecfb779   haribo   Date: 26/05/2016
430
    desc = models.CharField(max_length=45, blank=True, null=True)
7a79e25b   haribo   Date: 19/05/2016
431
432
433
434
435
436
437
438
439
440
441
442
    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...
443
class SiteWatch(models.Model):
6d86da1b   haribo   fix #3400, #3401,...
444
    updated = models.DateTimeField(blank=True, null=True, auto_now=True)
509509a8   haribo   Replacing admin.p...
445
446
447
448
    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...
449

509509a8   haribo   Replacing admin.p...
450
451
452
    class Meta:
        managed = True
        db_table = 'sitewatch'
6d86da1b   haribo   fix #3400, #3401,...
453
        verbose_name_plural = "Site watches"
c0c999f3   Etienne Pallier   admin : view or e...
454

509509a8   haribo   Replacing admin.p...
455
456
    def __str__(self):
        return (str(self.updated))
c0c999f3   Etienne Pallier   admin : view or e...
457
458


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

509509a8   haribo   Replacing admin.p...
462
463
464
    class Meta:
        managed = True
        db_table = 'sitewatchhistory'
6d86da1b   haribo   fix #3400, #3401,...
465
        verbose_name_plural = "Site watch histories"
c0c999f3   Etienne Pallier   admin : view or e...
466
467


509509a8   haribo   Replacing admin.p...
468
469
470
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
471
    xml_file = models.CharField(max_length=45, blank=True, null=True)
c0c999f3   Etienne Pallier   admin : view or e...
472

509509a8   haribo   Replacing admin.p...
473
474
475
    class Meta:
        managed = True
        db_table = 'strategyobs'
6d86da1b   haribo   fix #3400, #3401,...
476
        verbose_name_plural = "Strategy obs"
c0c999f3   Etienne Pallier   admin : view or e...
477

509509a8   haribo   Replacing admin.p...
478
479
    def __str__(self):
        return (str(self.name))
c0c999f3   Etienne Pallier   admin : view or e...
480
481


bb45cd4a   haribo   Date: 25/05/2016
482
483
484
485
486
487
488
489
490
491
492
493
494
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...
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
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...
517

509509a8   haribo   Replacing admin.p...
518
519
520
    class Meta:
        managed = True
        db_table = 'telescope'
c0c999f3   Etienne Pallier   admin : view or e...
521

509509a8   haribo   Replacing admin.p...
522
523
    def __str__(self):
        return (self.device.name)
c0c999f3   Etienne Pallier   admin : view or e...
524
525


509509a8   haribo   Replacing admin.p...
526
527
528
529
530
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...
531

509509a8   haribo   Replacing admin.p...
532
533
    class Meta:
        managed = True
94082e77   haribo   Date: 03/06/2016
534
        db_table = 'user_level'
c0c999f3   Etienne Pallier   admin : view or e...
535

509509a8   haribo   Replacing admin.p...
536
537
    def __str__(self):
        return (str(self.name))
c0c999f3   Etienne Pallier   admin : view or e...
538
539


509509a8   haribo   Replacing admin.p...
540
541
542
543
544
545
546
547
548
549
550
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...
551

509509a8   haribo   Replacing admin.p...
552
553
554
    class Meta:
        managed = True
        db_table = 'weatherwatch'
6d86da1b   haribo   fix #3400, #3401,...
555
        verbose_name_plural = "Weather watches"
c0c999f3   Etienne Pallier   admin : view or e...
556

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


509509a8   haribo   Replacing admin.p...
561
class WeatherWatchHistory(models.Model):
6d86da1b   haribo   fix #3400, #3401,...
562
    datetime = models.DateTimeField(blank=True, null=True, auto_now_add=True)
509509a8   haribo   Replacing admin.p...
563
564
565
566
567
568
569
570
571
    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...
572

509509a8   haribo   Replacing admin.p...
573
574
575
    class Meta:
        managed = True
        db_table = 'weatherwatchhistory'
6d86da1b   haribo   fix #3400, #3401,...
576
        verbose_name_plural = "Weather watch histories"
c0c999f3   Etienne Pallier   admin : view or e...
577

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