Commit 0d065f79825bccddd662673d88eabc8dcb7967e1

Authored by Etienne Pallier
1 parent 17d5e5ba
Exists in dev

new migration file for AgentsSurvey

Please do :
1) git pull
2) cd src/
3) ./manage.py migrate
pyros
... ... @@ -210,7 +210,9 @@ def pyros_launcher(test, verbose):
210 210 def shell():
211 211 print()
212 212 print("Launching a pyros shell")
213   - print("From this shell, type 'from common import models' to import all the pyros objects")
  213 + print("From this shell, type 'from common.models import *' to import all the pyros objects")
  214 + print("Then, you can create any pyros object just by typing its name")
  215 + print("For example, to create a AgentsSurvey object, type 'agent_survey = AgentsSurvey()'")
214 216 print("See documentation, chapter '9.6 - Play with the pyros objects' for more details")
215 217 print("Type 'exit()' to quit")
216 218 print()
... ...
src/common/migrations/0001_initial.py 0 → 100644
... ... @@ -0,0 +1,717 @@
  1 +# Generated by Django 2.0.5 on 2018-06-21 09:32
  2 +
  3 +from django.conf import settings
  4 +import django.contrib.auth.models
  5 +from django.db import migrations, models
  6 +import django.db.models.deletion
  7 +import django.utils.timezone
  8 +
  9 +
  10 +class Migration(migrations.Migration):
  11 +
  12 + initial = True
  13 +
  14 + dependencies = [
  15 + ('auth', '0009_alter_user_last_name_max_length'),
  16 + ]
  17 +
  18 + operations = [
  19 + migrations.CreateModel(
  20 + name='PyrosUser',
  21 + fields=[
  22 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  23 + ('password', models.CharField(max_length=128, verbose_name='password')),
  24 + ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
  25 + ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
  26 + ('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')),
  27 + ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
  28 + ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
  29 + ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
  30 + ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
  31 + ('username', models.CharField(max_length=255, unique=True)),
  32 + ('is_active', models.BooleanField(default='False')),
  33 + ('first_time', models.BooleanField(default='False')),
  34 + ('desc', models.TextField(blank=True, null=True)),
  35 + ('created', models.DateTimeField(auto_now_add=True, null=True)),
  36 + ('updated', models.DateTimeField(auto_now=True, null=True)),
  37 + ('tel', models.CharField(blank=True, max_length=45, null=True)),
  38 + ('address', models.TextField(blank=True, max_length=100, null=True)),
  39 + ('laboratory', models.CharField(blank=True, max_length=45, null=True)),
  40 + ('last_connect', models.DateTimeField(blank=True, null=True)),
  41 + ('cur_connect', models.DateTimeField(blank=True, null=True)),
  42 + ('putvalid_beg', models.DateTimeField(blank=True, null=True)),
  43 + ('putvalid_end', models.DateTimeField(blank=True, null=True)),
  44 + ('acqvalid_beg', models.CharField(blank=True, max_length=45, null=True)),
  45 + ('acqvalid_end', models.CharField(blank=True, max_length=45, null=True)),
  46 + ('quota', models.FloatField(blank=True, null=True)),
  47 + ('quota_rea', models.FloatField(blank=True, null=True)),
  48 + ('u_priority', models.IntegerField(blank=True, null=True)),
  49 + ('p_priority', models.IntegerField(blank=True, null=True)),
  50 + ('dir_level', models.IntegerField(blank=True, null=True)),
  51 + ('can_del_void_req', models.BooleanField(default=False)),
  52 + ],
  53 + options={
  54 + 'db_table': 'pyros_user',
  55 + 'managed': True,
  56 + },
  57 + managers=[
  58 + ('objects', django.contrib.auth.models.UserManager()),
  59 + ],
  60 + ),
  61 + migrations.CreateModel(
  62 + name='Album',
  63 + fields=[
  64 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  65 + ('name', models.CharField(blank=True, max_length=45, null=True)),
  66 + ('desc', models.TextField(blank=True, null=True)),
  67 + ('created', models.DateTimeField(auto_now_add=True, null=True)),
  68 + ('updated', models.DateTimeField(auto_now=True, null=True)),
  69 + ('complete', models.BooleanField(default=False)),
  70 + ],
  71 + options={
  72 + 'db_table': 'album',
  73 + 'managed': True,
  74 + },
  75 + ),
  76 + migrations.CreateModel(
  77 + name='Config',
  78 + fields=[
  79 + ('id', models.IntegerField(default='1', primary_key=True, serialize=False)),
  80 + ('latitude', models.FloatField(default=1)),
  81 + ('local_time_zone', models.FloatField(default=1)),
  82 + ('longitude', models.FloatField(default=1)),
  83 + ('altitude', models.FloatField(default=1)),
  84 + ('horizon_line', models.FloatField(default=1)),
  85 + ('row_data_save_frequency', models.IntegerField(default='300')),
  86 + ('request_frequency', models.IntegerField(default='300')),
  87 + ('analysed_data_save', models.IntegerField(default='300')),
  88 + ('telescope_ip_address', models.CharField(default='127.0.0.1', max_length=45)),
  89 + ('camera_ip_address', models.CharField(default='127.0.0.1', max_length=45)),
  90 + ('plc_ip_address', models.CharField(default='127.0.0.1', max_length=45)),
  91 + ('global_mode', models.BooleanField(default='True')),
  92 + ('ack', models.BooleanField(default='True')),
  93 + ('bypass', models.BooleanField(default='True')),
  94 + ('scheduler_state', models.CharField(choices=[('0', 'init'), ('1', 'sleeping'), ('2', 'startup'), ('3', 'observing'), ('4', 'shutdown')], default=0, max_length=1)),
  95 + ('force_passive_mode', models.BooleanField(default='False')),
  96 + ],
  97 + options={
  98 + 'verbose_name_plural': 'Config',
  99 + 'db_table': 'config',
  100 + 'managed': True,
  101 + },
  102 + ),
  103 + migrations.CreateModel(
  104 + name='Country',
  105 + fields=[
  106 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  107 + ('name', models.CharField(blank=True, max_length=45, null=True)),
  108 + ('desc', models.TextField(blank=True, null=True)),
  109 + ('quota', models.FloatField(blank=True, null=True)),
  110 + ],
  111 + options={
  112 + 'verbose_name_plural': 'Countries',
  113 + 'db_table': 'country',
  114 + 'managed': True,
  115 + },
  116 + ),
  117 + migrations.CreateModel(
  118 + name='Detector',
  119 + fields=[
  120 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  121 + ('name', models.CharField(blank=True, max_length=45, null=True)),
  122 + ('desc', models.TextField(blank=True, null=True)),
  123 + ('created', models.DateTimeField(auto_now_add=True, null=True)),
  124 + ('updated', models.DateTimeField(auto_now=True, null=True)),
  125 + ('is_online', models.BooleanField(default=False)),
  126 + ('status', models.CharField(blank=True, max_length=11, null=True)),
  127 + ('maintenance_date', models.DateTimeField(blank=True, null=True)),
  128 + ('nb_photo_x', models.IntegerField(blank=True, null=True)),
  129 + ('nb_photo_y', models.IntegerField(blank=True, null=True)),
  130 + ('photo_size_x', models.IntegerField(blank=True, null=True)),
  131 + ('photo_size_y', models.IntegerField(blank=True, null=True)),
  132 + ('has_shutter', models.BooleanField(default=False)),
  133 + ('equivalent_foc_len', models.CharField(blank=True, max_length=45, null=True)),
  134 + ('acq_start', models.DateTimeField(blank=True, null=True)),
  135 + ('acq_stop', models.DateTimeField(blank=True, null=True)),
  136 + ('check_temp', models.FloatField(blank=True, null=True)),
  137 + ('gain', models.FloatField(blank=True, null=True)),
  138 + ('readout_noise', models.FloatField(blank=True, null=True)),
  139 + ('readout_time', models.FloatField(blank=True, null=True)),
  140 + ('idcam_readout_mode', models.IntegerField(blank=True, null=True)),
  141 + ],
  142 + options={
  143 + 'db_table': 'detector',
  144 + 'managed': True,
  145 + },
  146 + ),
  147 + migrations.CreateModel(
  148 + name='Dome',
  149 + fields=[
  150 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  151 + ('name', models.CharField(blank=True, max_length=45, null=True)),
  152 + ('desc', models.TextField(blank=True, null=True)),
  153 + ('created', models.DateTimeField(auto_now_add=True, null=True)),
  154 + ('updated', models.DateTimeField(auto_now=True, null=True)),
  155 + ('is_online', models.BooleanField(default=False)),
  156 + ('status', models.CharField(blank=True, max_length=11, null=True)),
  157 + ('maintenance_date', models.DateTimeField(blank=True, null=True)),
  158 + ('open', models.BooleanField(default=False)),
  159 + ],
  160 + options={
  161 + 'db_table': 'dome',
  162 + 'managed': True,
  163 + },
  164 + ),
  165 + migrations.CreateModel(
  166 + name='Filter',
  167 + fields=[
  168 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  169 + ('name', models.CharField(blank=True, max_length=45, null=True)),
  170 + ('desc', models.TextField(blank=True, null=True)),
  171 + ('created', models.DateTimeField(auto_now_add=True, null=True)),
  172 + ('updated', models.DateTimeField(auto_now=True, null=True)),
  173 + ('is_online', models.BooleanField(default=False)),
  174 + ('status', models.CharField(blank=True, max_length=11, null=True)),
  175 + ('maintenance_date', models.DateTimeField(blank=True, null=True)),
  176 + ('category', models.CharField(blank=True, max_length=1, null=True)),
  177 + ('transmission_curve_doc', models.CharField(blank=True, max_length=45, null=True)),
  178 + ],
  179 + options={
  180 + 'db_table': 'filter',
  181 + 'managed': True,
  182 + },
  183 + ),
  184 + migrations.CreateModel(
  185 + name='FilterWheel',
  186 + fields=[
  187 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  188 + ('name', models.CharField(blank=True, max_length=45, null=True)),
  189 + ('desc', models.TextField(blank=True, null=True)),
  190 + ('created', models.DateTimeField(auto_now_add=True, null=True)),
  191 + ('updated', models.DateTimeField(auto_now=True, null=True)),
  192 + ('is_online', models.BooleanField(default=False)),
  193 + ('status', models.CharField(blank=True, max_length=11, null=True)),
  194 + ('maintenance_date', models.DateTimeField(blank=True, null=True)),
  195 + ('detector', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='filter_wheel', to='common.Detector')),
  196 + ],
  197 + options={
  198 + 'db_table': 'filter_wheel',
  199 + 'managed': True,
  200 + },
  201 + ),
  202 + migrations.CreateModel(
  203 + name='Image',
  204 + fields=[
  205 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  206 + ('name', models.CharField(blank=True, max_length=45, null=True)),
  207 + ('desc', models.TextField(blank=True, null=True)),
  208 + ('created', models.DateTimeField(auto_now_add=True, null=True)),
  209 + ('updated', models.DateTimeField(auto_now=True, null=True)),
  210 + ('date_from_gps', models.CharField(blank=True, max_length=45, null=True)),
  211 + ('level', models.IntegerField(blank=True, null=True)),
  212 + ('type', models.CharField(blank=True, max_length=5, null=True)),
  213 + ('quality', models.CharField(blank=True, max_length=45, null=True)),
  214 + ('flaggps', models.CharField(blank=True, max_length=45, null=True)),
  215 + ('exposure', models.CharField(blank=True, max_length=45, null=True)),
  216 + ('tempext', models.CharField(blank=True, max_length=45, null=True)),
  217 + ('pressure', models.CharField(blank=True, max_length=45, null=True)),
  218 + ('humidext', models.CharField(blank=True, max_length=45, null=True)),
  219 + ('wind', models.CharField(blank=True, max_length=45, null=True)),
  220 + ('wind_dir', models.CharField(blank=True, max_length=45, null=True)),
  221 + ('dwnimg', models.CharField(blank=True, max_length=45, null=True)),
  222 + ('dwncata', models.CharField(blank=True, max_length=45, null=True)),
  223 + ('dwn', models.CharField(blank=True, max_length=45, null=True)),
  224 + ('level0_fits_name', models.CharField(blank=True, max_length=45, null=True)),
  225 + ('level1a_fits_name', models.CharField(blank=True, max_length=45, null=True)),
  226 + ('level1b_fits_name', models.CharField(blank=True, max_length=45, null=True)),
  227 + ],
  228 + options={
  229 + 'db_table': 'image',
  230 + 'managed': True,
  231 + },
  232 + ),
  233 + migrations.CreateModel(
  234 + name='Log',
  235 + fields=[
  236 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  237 + ('agent', models.CharField(blank=True, max_length=45, null=True)),
  238 + ('created', models.DateTimeField(auto_now_add=True, null=True)),
  239 + ('message', models.TextField(blank=True, null=True)),
  240 + ],
  241 + options={
  242 + 'db_table': 'log',
  243 + 'managed': True,
  244 + },
  245 + ),
  246 + migrations.CreateModel(
  247 + name='NrtAnalysis',
  248 + fields=[
  249 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  250 + ('name', models.CharField(blank=True, max_length=45, null=True)),
  251 + ('desc', models.TextField(blank=True, null=True)),
  252 + ('created', models.DateTimeField(auto_now_add=True, null=True)),
  253 + ('updated', models.DateTimeField(auto_now=True, null=True)),
  254 + ('analysis', models.TextField(blank=True, null=True)),
  255 + ],
  256 + options={
  257 + 'verbose_name_plural': 'Nrt analyzes',
  258 + 'db_table': 'nrtanalysis',
  259 + 'managed': True,
  260 + },
  261 + ),
  262 + migrations.CreateModel(
  263 + name='Plan',
  264 + fields=[
  265 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  266 + ('name', models.CharField(blank=True, max_length=45, null=True)),
  267 + ('desc', models.CharField(blank=True, max_length=45, null=True)),
  268 + ('created', models.DateTimeField(auto_now_add=True, null=True)),
  269 + ('updated', models.DateTimeField(auto_now=True, null=True)),
  270 + ('duration', models.FloatField(blank=True, default=0, null=True)),
  271 + ('position', models.CharField(blank=True, max_length=45, null=True)),
  272 + ('exposure_time', models.FloatField(blank=True, null=True)),
  273 + ('nb_images', models.IntegerField(blank=True, null=True)),
  274 + ('dithering', models.BooleanField(default=False)),
  275 + ('complete', models.BooleanField(default=False)),
  276 + ('album', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='plans', to='common.Album')),
  277 + ('filter', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='plans', to='common.Filter')),
  278 + ],
  279 + options={
  280 + 'db_table': 'plan',
  281 + 'managed': True,
  282 + },
  283 + ),
  284 + migrations.CreateModel(
  285 + name='PlcDevice',
  286 + fields=[
  287 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  288 + ('is_online', models.BooleanField(default=False)),
  289 + ('status', models.CharField(blank=True, max_length=11, null=True)),
  290 + ('maintenance_date', models.DateTimeField(blank=True, null=True)),
  291 + ('name', models.CharField(blank=True, max_length=45, null=True)),
  292 + ('desc', models.TextField(blank=True, null=True)),
  293 + ('created', models.DateTimeField(auto_now_add=True, null=True)),
  294 + ('updated', models.DateTimeField(auto_now=True, null=True)),
  295 + ],
  296 + options={
  297 + 'db_table': 'plc_devices',
  298 + 'managed': True,
  299 + },
  300 + ),
  301 + migrations.CreateModel(
  302 + name='PlcDeviceStatus',
  303 + fields=[
  304 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  305 + ('created', models.DateTimeField(auto_now_add=True)),
  306 + ('outside_temp', models.DecimalField(blank=True, decimal_places=8, max_digits=15, null=True)),
  307 + ('outside_temp_unit', models.CharField(blank=True, max_length=45, null=True)),
  308 + ('outside_humidity', models.DecimalField(blank=True, decimal_places=8, max_digits=15, null=True)),
  309 + ('outside_humidity_unit', models.CharField(blank=True, max_length=45, null=True)),
  310 + ('pressure', models.DecimalField(blank=True, decimal_places=8, max_digits=15, null=True)),
  311 + ('pressure_unit', models.CharField(blank=True, max_length=45, null=True)),
  312 + ('rain_rate', models.DecimalField(blank=True, decimal_places=8, max_digits=15, null=True)),
  313 + ('rain_rate_unit', models.CharField(blank=True, max_length=45, null=True)),
  314 + ('wind_speed', models.DecimalField(blank=True, decimal_places=8, max_digits=15, null=True)),
  315 + ('wind_speed_unit', models.CharField(blank=True, max_length=45, null=True)),
  316 + ('wind_dir', models.DecimalField(blank=True, decimal_places=8, max_digits=15, null=True)),
  317 + ('wind_dir_unit', models.CharField(blank=True, max_length=45, null=True)),
  318 + ('dew_point', models.DecimalField(blank=True, decimal_places=8, max_digits=15, null=True)),
  319 + ('dew_point_unit', models.CharField(blank=True, max_length=45, null=True)),
  320 + ('analog', models.DecimalField(blank=True, decimal_places=8, max_digits=15, null=True)),
  321 + ('analog_unit', models.CharField(blank=True, max_length=45, null=True)),
  322 + ('digital', models.DecimalField(blank=True, decimal_places=8, max_digits=15, null=True)),
  323 + ('digital_unit', models.CharField(blank=True, max_length=45, null=True)),
  324 + ('inside_temp', models.DecimalField(blank=True, decimal_places=8, max_digits=15, null=True)),
  325 + ('inside_temp_unit', models.CharField(blank=True, max_length=45, null=True)),
  326 + ('inside_humidity', models.DecimalField(blank=True, decimal_places=8, max_digits=15, null=True)),
  327 + ('inside_humidity_unit', models.CharField(blank=True, max_length=45, null=True)),
  328 + ('wind_dir_cardinal', models.CharField(blank=True, max_length=45, null=True)),
  329 + ('wind_dir_cardinal_unit', models.CharField(blank=True, max_length=45, null=True)),
  330 + ('sensor_temperature', models.DecimalField(blank=True, decimal_places=8, max_digits=15, null=True)),
  331 + ('sensor_temperature_unit', models.CharField(blank=True, max_length=45, null=True)),
  332 + ('sky_temperature', models.DecimalField(blank=True, decimal_places=8, max_digits=15, null=True)),
  333 + ('sky_temperature_unit', models.CharField(blank=True, max_length=45, null=True)),
  334 + ('status', models.CharField(blank=True, max_length=45, null=True)),
  335 + ('current', models.DecimalField(blank=True, decimal_places=8, max_digits=15, null=True)),
  336 + ('current_unit', models.CharField(blank=True, max_length=45, null=True)),
  337 + ('is_safe', models.BooleanField(default=True)),
  338 + ('plc_mode', models.CharField(max_length=4, null=True)),
  339 + ('device', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='current_status', to='common.PlcDevice')),
  340 + ],
  341 + options={
  342 + 'db_table': 'plc_devices_status',
  343 + 'managed': True,
  344 + },
  345 + ),
  346 + migrations.CreateModel(
  347 + name='Request',
  348 + fields=[
  349 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  350 + ('name', models.CharField(blank=True, max_length=45, null=True)),
  351 + ('desc', models.TextField(blank=True, null=True)),
  352 + ('created', models.DateTimeField(auto_now_add=True, null=True)),
  353 + ('updated', models.DateTimeField(auto_now=True, null=True)),
  354 + ('is_alert', models.BooleanField(default=False)),
  355 + ('target_type', models.CharField(blank=True, max_length=8, null=True)),
  356 + ('status', models.CharField(blank=True, max_length=10, null=True)),
  357 + ('autodeposit', models.BooleanField(default=False)),
  358 + ('checkpoint', models.CharField(blank=True, max_length=45, null=True)),
  359 + ('flag', models.CharField(blank=True, max_length=45, null=True)),
  360 + ('complete', models.BooleanField(default=False)),
  361 + ('submitted', models.BooleanField(default=False)),
  362 + ],
  363 + options={
  364 + 'db_table': 'request',
  365 + 'managed': True,
  366 + },
  367 + ),
  368 + migrations.CreateModel(
  369 + name='Schedule',
  370 + fields=[
  371 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  372 + ('created', models.DateTimeField(auto_now_add=True, null=True)),
  373 + ('plan_night_start', models.DecimalField(decimal_places=8, default=0.0, max_digits=15)),
  374 + ('plan_end', models.DecimalField(decimal_places=8, default=0.0, max_digits=15)),
  375 + ('plan_start', models.DecimalField(decimal_places=8, default=0.0, max_digits=15)),
  376 + ('flag', models.CharField(blank=True, max_length=45, null=True)),
  377 + ],
  378 + options={
  379 + 'verbose_name_plural': 'Schedules',
  380 + 'db_table': 'schedule',
  381 + 'managed': True,
  382 + },
  383 + ),
  384 + migrations.CreateModel(
  385 + name='ScheduleHasSequences',
  386 + fields=[
  387 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  388 + ('status', models.CharField(blank=True, choices=[('INCPL', 'Incomplete'), ('CPL', 'Complete'), ('TBP', 'To be planned'), ('PLND', 'Planned'), ('UNPLN', 'Unplannable'), ('PNDG', 'Pending'), ('EXD', 'Executed'), ('EXING', 'Executing'), ('RJTD', 'Rejected'), ('CNCLD', 'Cancelled'), ('INVL', 'Invalid')], max_length=11, null=True)),
  389 + ('desc', models.CharField(blank=True, max_length=45, null=True)),
  390 + ('tsp', models.DecimalField(decimal_places=8, default=-1.0, max_digits=15)),
  391 + ('tep', models.DecimalField(decimal_places=8, default=-1.0, max_digits=15)),
  392 + ('deltaTL', models.DecimalField(decimal_places=8, default=-1.0, max_digits=15)),
  393 + ('deltaTR', models.DecimalField(decimal_places=8, default=-1.0, max_digits=15)),
  394 + ('schedule', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='shs', to='common.Schedule')),
  395 + ],
  396 + options={
  397 + 'db_table': 'schedule_has_sequences',
  398 + 'managed': True,
  399 + },
  400 + ),
  401 + migrations.CreateModel(
  402 + name='ScientificProgram',
  403 + fields=[
  404 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  405 + ('name', models.CharField(blank=True, max_length=45, null=True)),
  406 + ('desc', models.TextField(blank=True, null=True)),
  407 + ('quota', models.FloatField(blank=True, null=True)),
  408 + ('priority', models.IntegerField(blank=True, null=True)),
  409 + ('pyros_users', models.ManyToManyField(related_name='scientific_programs', to=settings.AUTH_USER_MODEL)),
  410 + ],
  411 + options={
  412 + 'db_table': 'scientific_program',
  413 + 'managed': True,
  414 + },
  415 + ),
  416 + migrations.CreateModel(
  417 + name='Sequence',
  418 + fields=[
  419 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  420 + ('name', models.CharField(blank=True, max_length=45, null=True)),
  421 + ('desc', models.TextField(blank=True, null=True)),
  422 + ('created', models.DateTimeField(auto_now_add=True, null=True)),
  423 + ('updated', models.DateTimeField(auto_now=True, null=True)),
  424 + ('is_alert', models.BooleanField(default=False)),
  425 + ('status', models.CharField(blank=True, choices=[('INCPL', 'Incomplete'), ('CPL', 'Complete'), ('TBP', 'To be planned'), ('PLND', 'Planned'), ('UNPLN', 'Unplannable'), ('PNDG', 'Pending'), ('EXD', 'Executed'), ('EXING', 'Executing'), ('RJTD', 'Rejected'), ('CNCLD', 'Cancelled'), ('INVL', 'Invalid')], max_length=11, null=True)),
  426 + ('target_coords', models.CharField(blank=True, max_length=100, null=True)),
  427 + ('with_drift', models.BooleanField(default=False)),
  428 + ('priority', models.IntegerField(blank=True, null=True)),
  429 + ('analysis_method', models.CharField(blank=True, max_length=45, null=True)),
  430 + ('moon_min', models.IntegerField(blank=True, null=True)),
  431 + ('alt_min', models.IntegerField(blank=True, null=True)),
  432 + ('type', models.CharField(blank=True, max_length=6, null=True)),
  433 + ('img_current', models.CharField(blank=True, max_length=45, null=True)),
  434 + ('img_total', models.CharField(blank=True, max_length=45, null=True)),
  435 + ('not_obs', models.BooleanField(default=False)),
  436 + ('obsolete', models.BooleanField(default=False)),
  437 + ('processing', models.BooleanField(default=False)),
  438 + ('flag', models.CharField(blank=True, max_length=45, null=True)),
  439 + ('jd1', models.DecimalField(decimal_places=8, default=0.0, max_digits=15)),
  440 + ('jd2', models.DecimalField(decimal_places=8, default=0.0, max_digits=15)),
  441 + ('t_prefered', models.DecimalField(decimal_places=8, default=-1.0, max_digits=15)),
  442 + ('duration', models.DecimalField(decimal_places=8, default=-1.0, max_digits=15)),
  443 + ('overhead', models.DecimalField(decimal_places=8, default=0, max_digits=15)),
  444 + ('ra', models.FloatField(blank=True, null=True)),
  445 + ('dec', models.FloatField(blank=True, null=True)),
  446 + ],
  447 + options={
  448 + 'db_table': 'sequence',
  449 + 'managed': True,
  450 + },
  451 + ),
  452 + migrations.CreateModel(
  453 + name='SiteWatch',
  454 + fields=[
  455 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  456 + ('global_status', models.CharField(blank=True, max_length=255, null=True)),
  457 + ('updated', models.DateTimeField(auto_now=True, null=True)),
  458 + ('lights', models.CharField(blank=True, max_length=45, null=True)),
  459 + ('dome', models.CharField(blank=True, max_length=45, null=True)),
  460 + ('doors', models.CharField(blank=True, max_length=45, null=True)),
  461 + ('temperature', models.FloatField(blank=True, null=True)),
  462 + ('shutter', models.FloatField(blank=True, null=True)),
  463 + ('pressure', models.FloatField(blank=True, null=True)),
  464 + ('humidity', models.FloatField(blank=True, null=True)),
  465 + ],
  466 + options={
  467 + 'verbose_name_plural': 'Site watches',
  468 + 'db_table': 'sitewatch',
  469 + 'managed': True,
  470 + },
  471 + ),
  472 + migrations.CreateModel(
  473 + name='SiteWatchHistory',
  474 + fields=[
  475 + ('id', models.IntegerField(primary_key=True, serialize=False)),
  476 + ],
  477 + options={
  478 + 'verbose_name_plural': 'Site watch histories',
  479 + 'db_table': 'sitewatchhistory',
  480 + 'managed': True,
  481 + },
  482 + ),
  483 + migrations.CreateModel(
  484 + name='StrategyObs',
  485 + fields=[
  486 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  487 + ('name', models.CharField(blank=True, max_length=45, null=True)),
  488 + ('desc', models.TextField(blank=True, null=True)),
  489 + ('xml_file', models.CharField(blank=True, max_length=45, null=True)),
  490 + ('is_default', models.BooleanField(default=False)),
  491 + ],
  492 + options={
  493 + 'verbose_name_plural': 'Strategy obs',
  494 + 'db_table': 'strategyobs',
  495 + 'managed': True,
  496 + },
  497 + ),
  498 + migrations.CreateModel(
  499 + name='TaskId',
  500 + fields=[
  501 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  502 + ('task', models.CharField(blank=True, max_length=45, null=True)),
  503 + ('created', models.DateTimeField(auto_now_add=True, null=True)),
  504 + ('task_id', models.CharField(blank=True, max_length=45, null=True)),
  505 + ],
  506 + options={
  507 + 'db_table': 'task_id',
  508 + 'managed': True,
  509 + },
  510 + ),
  511 + migrations.CreateModel(
  512 + name='Telescope',
  513 + fields=[
  514 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  515 + ('name', models.CharField(blank=True, max_length=45, null=True)),
  516 + ('desc', models.TextField(blank=True, null=True)),
  517 + ('created', models.DateTimeField(auto_now_add=True, null=True)),
  518 + ('updated', models.DateTimeField(auto_now=True, null=True)),
  519 + ('is_online', models.BooleanField(default=False)),
  520 + ('status', models.CharField(blank=True, max_length=11, null=True)),
  521 + ('maintenance_date', models.DateTimeField(blank=True, null=True)),
  522 + ('mount_type', models.CharField(blank=True, max_length=9, null=True)),
  523 + ('diameter', models.FloatField(blank=True, null=True)),
  524 + ('latitude', models.FloatField(blank=True, null=True)),
  525 + ('longitude', models.FloatField(blank=True, null=True)),
  526 + ('sens', models.CharField(blank=True, max_length=1, null=True)),
  527 + ('altitude', models.FloatField(blank=True, null=True)),
  528 + ('readout_time', models.IntegerField(blank=True, null=True)),
  529 + ('slew_time', models.IntegerField(blank=True, null=True)),
  530 + ('slew_dead', models.IntegerField(blank=True, null=True)),
  531 + ('slew_rate_max', models.FloatField(blank=True, null=True)),
  532 + ('horizon_type', models.CharField(blank=True, max_length=45, null=True)),
  533 + ('horizon_def', models.FloatField(blank=True, null=True)),
  534 + ('lim_dec_max', models.FloatField(blank=True, null=True)),
  535 + ('lim_dec_min', models.FloatField(blank=True, null=True)),
  536 + ('lim_ha_rise', models.FloatField(blank=True, null=True)),
  537 + ('lim_ha_set', models.FloatField(blank=True, null=True)),
  538 + ('address', models.CharField(blank=True, max_length=45, null=True)),
  539 + ('night_elev_sun', models.FloatField(blank=True, null=True)),
  540 + ('mpc_code', models.CharField(blank=True, max_length=45, null=True)),
  541 + ],
  542 + options={
  543 + 'db_table': 'telescope',
  544 + 'managed': True,
  545 + },
  546 + ),
  547 + migrations.CreateModel(
  548 + name='UserLevel',
  549 + fields=[
  550 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  551 + ('name', models.CharField(blank=True, max_length=45, null=True)),
  552 + ('desc', models.TextField(blank=True, null=True)),
  553 + ('priority', models.IntegerField(blank=True, null=True)),
  554 + ('quota', models.FloatField(blank=True, null=True)),
  555 + ],
  556 + options={
  557 + 'db_table': 'user_level',
  558 + 'managed': True,
  559 + },
  560 + ),
  561 + migrations.CreateModel(
  562 + name='Version',
  563 + fields=[
  564 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  565 + ('module_name', models.CharField(blank=True, max_length=45, null=True)),
  566 + ('version', models.CharField(blank=True, max_length=15, null=True)),
  567 + ('created', models.DateTimeField(auto_now_add=True, null=True)),
  568 + ('updated', models.DateTimeField(auto_now=True, null=True)),
  569 + ],
  570 + options={
  571 + 'db_table': 'version',
  572 + 'managed': True,
  573 + },
  574 + ),
  575 + migrations.CreateModel(
  576 + name='WeatherWatch',
  577 + fields=[
  578 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  579 + ('global_status', models.CharField(blank=True, max_length=255, null=True)),
  580 + ('updated', models.DateTimeField(auto_now=True, null=True)),
  581 + ('humidity', models.FloatField(blank=True, null=True)),
  582 + ('wind', models.FloatField(blank=True, null=True)),
  583 + ('wind_dir', models.CharField(blank=True, max_length=45, null=True)),
  584 + ('temperature', models.FloatField(blank=True, null=True)),
  585 + ('pressure', models.FloatField(blank=True, null=True)),
  586 + ('rain', models.FloatField(blank=True, null=True)),
  587 + ('cloud', models.FloatField(blank=True, null=True)),
  588 + ],
  589 + options={
  590 + 'verbose_name_plural': 'Weather watches',
  591 + 'db_table': 'weatherwatch',
  592 + 'managed': True,
  593 + },
  594 + ),
  595 + migrations.CreateModel(
  596 + name='WeatherWatchHistory',
  597 + fields=[
  598 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  599 + ('datetime', models.DateTimeField(auto_now_add=True, null=True)),
  600 + ('humid_int', models.FloatField(blank=True, null=True)),
  601 + ('humid_ext', models.CharField(blank=True, max_length=45, null=True)),
  602 + ('wind', models.CharField(blank=True, max_length=45, null=True)),
  603 + ('wind_dir', models.CharField(blank=True, max_length=45, null=True)),
  604 + ('temp_int', models.CharField(blank=True, max_length=45, null=True)),
  605 + ('temp_ext', models.CharField(blank=True, max_length=45, null=True)),
  606 + ('pressure', models.CharField(blank=True, max_length=45, null=True)),
  607 + ('rain', models.CharField(blank=True, max_length=45, null=True)),
  608 + ('dwn', models.CharField(blank=True, max_length=45, null=True)),
  609 + ],
  610 + options={
  611 + 'verbose_name_plural': 'Weather watch histories',
  612 + 'db_table': 'weatherwatchhistory',
  613 + 'managed': True,
  614 + },
  615 + ),
  616 + migrations.CreateModel(
  617 + name='Alert',
  618 + fields=[
  619 + ('request', models.OneToOneField(default='', on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='common.Request')),
  620 + ('voevent_file', models.CharField(blank=True, max_length=45, null=True)),
  621 + ('author', models.CharField(blank=True, max_length=45, null=True)),
  622 + ('burst_jd', models.DecimalField(blank=True, decimal_places=8, max_digits=15, null=True)),
  623 + ('burst_ra', models.FloatField(blank=True, max_length=45, null=True)),
  624 + ('burst_dec', models.FloatField(blank=True, max_length=45, null=True)),
  625 + ('astro_coord_system', models.CharField(blank=True, max_length=45, null=True)),
  626 + ('jd_send', models.DecimalField(blank=True, decimal_places=8, max_digits=15, null=True)),
  627 + ('jd_received', models.DecimalField(blank=True, decimal_places=8, max_digits=15, null=True)),
  628 + ('trig_id', models.IntegerField(blank=True, null=True)),
  629 + ('error_radius', models.FloatField(blank=True, max_length=45, null=True)),
  630 + ('defly_not_grb', models.BooleanField(default=False)),
  631 + ('editor', models.CharField(blank=True, max_length=45, null=True)),
  632 + ('soln_status', models.CharField(blank=True, max_length=45, null=True)),
  633 + ('pkt_ser_num', models.IntegerField(blank=True, null=True)),
  634 + ('strategyobs', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='alerts', to='common.StrategyObs')),
  635 + ],
  636 + options={
  637 + 'db_table': 'alert',
  638 + 'managed': True,
  639 + },
  640 + bases=('common.request',),
  641 + ),
  642 + migrations.AddField(
  643 + model_name='sequence',
  644 + name='request',
  645 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sequences', to='common.Request'),
  646 + ),
  647 + migrations.AddField(
  648 + model_name='schedulehassequences',
  649 + name='sequence',
  650 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='shs', to='common.Sequence'),
  651 + ),
  652 + migrations.AddField(
  653 + model_name='schedule',
  654 + name='sequences',
  655 + field=models.ManyToManyField(related_name='schedules', through='common.ScheduleHasSequences', to='common.Sequence'),
  656 + ),
  657 + migrations.AddField(
  658 + model_name='request',
  659 + name='pyros_user',
  660 + field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='requests', to=settings.AUTH_USER_MODEL),
  661 + ),
  662 + migrations.AddField(
  663 + model_name='request',
  664 + name='scientific_program',
  665 + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='requests', to='common.ScientificProgram'),
  666 + ),
  667 + migrations.AddField(
  668 + model_name='image',
  669 + name='nrtanalysis',
  670 + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='images', to='common.NrtAnalysis'),
  671 + ),
  672 + migrations.AddField(
  673 + model_name='image',
  674 + name='plan',
  675 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='images', to='common.Plan'),
  676 + ),
  677 + migrations.AddField(
  678 + model_name='filter',
  679 + name='filter_wheel',
  680 + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='filters', to='common.FilterWheel'),
  681 + ),
  682 + migrations.AddField(
  683 + model_name='detector',
  684 + name='telescope',
  685 + field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='detectors', to='common.Telescope'),
  686 + ),
  687 + migrations.AddField(
  688 + model_name='album',
  689 + name='detector',
  690 + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='albums', to='common.Detector'),
  691 + ),
  692 + migrations.AddField(
  693 + model_name='album',
  694 + name='sequence',
  695 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='albums', to='common.Sequence'),
  696 + ),
  697 + migrations.AddField(
  698 + model_name='pyrosuser',
  699 + name='country',
  700 + field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='pyros_users', to='common.Country'),
  701 + ),
  702 + migrations.AddField(
  703 + model_name='pyrosuser',
  704 + name='groups',
  705 + field=models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups'),
  706 + ),
  707 + migrations.AddField(
  708 + model_name='pyrosuser',
  709 + name='user_level',
  710 + field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='pyros_users', to='common.UserLevel'),
  711 + ),
  712 + migrations.AddField(
  713 + model_name='pyrosuser',
  714 + name='user_permissions',
  715 + field=models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions'),
  716 + ),
  717 + ]
... ...
src/common/migrations/0002_auto_20180716_1011.py 0 → 100644
... ... @@ -0,0 +1,52 @@
  1 +# Generated by Django 2.0.5 on 2018-07-16 10:11
  2 +
  3 +from django.db import migrations, models
  4 +
  5 +
  6 +class Migration(migrations.Migration):
  7 +
  8 + dependencies = [
  9 + ('common', '0001_initial'),
  10 + ]
  11 +
  12 + operations = [
  13 + migrations.RemoveField(
  14 + model_name='config',
  15 + name='scheduler_state',
  16 + ),
  17 + migrations.AddField(
  18 + model_name='config',
  19 + name='lock',
  20 + field=models.BooleanField(default='False'),
  21 + ),
  22 + migrations.AddField(
  23 + model_name='config',
  24 + name='majordome_restarted',
  25 + field=models.BooleanField(default='False'),
  26 + ),
  27 + migrations.AddField(
  28 + model_name='config',
  29 + name='majordome_state',
  30 + field=models.CharField(default='', max_length=25),
  31 + ),
  32 + migrations.AddField(
  33 + model_name='config',
  34 + name='ntc',
  35 + field=models.BooleanField(default='False'),
  36 + ),
  37 + migrations.AddField(
  38 + model_name='config',
  39 + name='plc_timeout_seconds',
  40 + field=models.PositiveIntegerField(default=60),
  41 + ),
  42 + migrations.AddField(
  43 + model_name='config',
  44 + name='pyros_state',
  45 + field=models.CharField(default='Starting', max_length=25),
  46 + ),
  47 + migrations.AlterField(
  48 + model_name='config',
  49 + name='ack',
  50 + field=models.BooleanField(default='False'),
  51 + ),
  52 + ]
... ...
src/common/migrations/0003_auto_20180726_1017.py 0 → 100644
... ... @@ -0,0 +1,23 @@
  1 +# Generated by Django 2.0.5 on 2018-07-26 10:17
  2 +
  3 +from django.db import migrations, models
  4 +
  5 +
  6 +class Migration(migrations.Migration):
  7 +
  8 + dependencies = [
  9 + ('common', '0002_auto_20180716_1011'),
  10 + ]
  11 +
  12 + operations = [
  13 + migrations.AddField(
  14 + model_name='plcdevicestatus',
  15 + name='lights',
  16 + field=models.CharField(max_length=3, null=True),
  17 + ),
  18 + migrations.AddField(
  19 + model_name='plcdevicestatus',
  20 + name='shutters',
  21 + field=models.CharField(max_length=5, null=True),
  22 + ),
  23 + ]
... ...
src/common/migrations/0004_telescopecommand.py 0 → 100644
... ... @@ -0,0 +1,27 @@
  1 +# Generated by Django 2.0.5 on 2018-07-28 11:36
  2 +
  3 +from django.db import migrations, models
  4 +
  5 +
  6 +class Migration(migrations.Migration):
  7 +
  8 + dependencies = [
  9 + ('common', '0003_auto_20180726_1017'),
  10 + ]
  11 +
  12 + operations = [
  13 + migrations.CreateModel(
  14 + name='TelescopeCommand',
  15 + fields=[
  16 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  17 + ('created', models.DateTimeField(auto_now_add=True, null=True)),
  18 + ('answered', models.DateTimeField(blank=True, null=True)),
  19 + ('request', models.CharField(max_length=255)),
  20 + ('answer', models.TextField(blank=True, null=True)),
  21 + ],
  22 + options={
  23 + 'db_table': 'telescopecommand',
  24 + 'managed': True,
  25 + },
  26 + ),
  27 + ]
... ...
src/common/migrations/0005_agentssurvey.py 0 → 100644
... ... @@ -0,0 +1,28 @@
  1 +# Generated by Django 2.0.5 on 2019-02-21 13:35
  2 +
  3 +from django.db import migrations, models
  4 +
  5 +
  6 +class Migration(migrations.Migration):
  7 +
  8 + dependencies = [
  9 + ('common', '0004_telescopecommand'),
  10 + ]
  11 +
  12 + operations = [
  13 + migrations.CreateModel(
  14 + name='AgentsSurvey',
  15 + fields=[
  16 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  17 + ('created', models.DateTimeField(auto_now_add=True, null=True)),
  18 + ('validity_duration_sec', models.IntegerField(blank=True, null=True)),
  19 + ('name', models.CharField(blank=True, max_length=50, null=True)),
  20 + ('mode', models.CharField(blank=True, max_length=15, null=True)),
  21 + ('status', models.CharField(blank=True, max_length=15, null=True)),
  22 + ],
  23 + options={
  24 + 'db_table': 'agents_survey',
  25 + 'managed': True,
  26 + },
  27 + ),
  28 + ]
... ...
src/common/models.py
... ... @@ -73,23 +73,22 @@ class Request(models.Model):
73 73 ------------------------
74 74 """
75 75  
76   -# TODO:
77   -"""
78   -A chaque tour de boucle, remplir champ "iamalive" avec timestamp + durée validité (> temps iteration, n minutes par défaut)
79   -+ nom agent dans table agents_survey (nom agent + mode + status + updated timestamp)
80   -"""
81 76 class AgentsSurvey(models.Model):
82   - name = models.CharField(max_length=45, blank=True, null=True)
83   - desc = models.TextField(blank=True, null=True)
  77 + """
  78 + | id | created | validity_duration_sec (default=1mn) | name | mode (active/idle) | status (launch/init/loop/exit/...) |
  79 + """
84 80 created = models.DateTimeField(blank=True, null=True, auto_now_add=True)
85   - updated = models.DateTimeField(blank=True, null=True, auto_now=True)
  81 + validity_duration_sec = models.IntegerField(blank=True, null=True)
  82 + name = models.CharField(max_length=50, blank=True, null=True)
  83 + mode = models.CharField(max_length=15, blank=True, null=True)
  84 + status = models.CharField(max_length=15, blank=True, null=True)
86 85  
87 86 class Meta:
88 87 managed = True
89 88 db_table = 'agents_survey'
90 89  
91 90 def __str__(self):
92   - return (str(self.name))
  91 + return (f"Agent {self.name} at {self.created} in mode {self.mode} and status {self.status}")
93 92  
94 93  
95 94 class Album(models.Model):
... ...