# 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 # Feel free to rename the models, but don't rename db_table values or field names. from __future__ import unicode_literals from django.contrib.auth.models import User from django.db import models class Album(models.Model): sequence = models.ForeignKey('Sequence', models.CASCADE, related_name="albums") detector = models.ForeignKey('Detector', models.DO_NOTHING, related_name="albums") name = models.CharField(max_length=45, blank=True, null=True) desc = models.TextField(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 = 'album' def __str__(self): return (str(self.name)) class Alert(models.Model): request = models.OneToOneField('Request', models.CASCADE) strategyobs = models.ForeignKey('StrategyObs', models.DO_NOTHING, related_name="alerts") 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) def_not_grb = models.BooleanField(default=False) 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) class Meta: managed = True db_table = 'alert' def __str__(self): return str(self.request.name) def request_name(self): return self.__str__() request_name.short_description = "Name" 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) class Meta: managed = True db_table = 'country' verbose_name_plural = "Countries" def __str__(self): return (str(self.name)) class Detector(models.Model): device = models.OneToOneField('Device', models.CASCADE) telescope = models.ForeignKey('Telescope', models.DO_NOTHING, related_name="detectors") 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) has_shutter = models.BooleanField(default=False) 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) class Meta: managed = True db_table = 'detector' def __str__(self): return str(self.device.name) def device_name(self): return self.__str__() device_name.short_description = "Name" class Device(models.Model): name = models.CharField(max_length=45, blank=True, null=True) desc = models.TextField(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) is_online = models.BooleanField(default=False) status = models.CharField(max_length=11, blank=True, null=True) maintenance_date = models.DateTimeField(blank=True, null=True) class Meta: managed = True db_table = 'device' def __str__(self): return (str(self.name)) class Filter(models.Model): device = models.OneToOneField(Device, models.CASCADE) detector = models.ForeignKey(Detector, models.DO_NOTHING, related_name="filters") category = models.CharField(max_length=1, blank=True, null=True) transmission_curve_doc = models.CharField(max_length=45, blank=True, null=True) class Meta: managed = True db_table = 'filter' def __str__(self): return (str(self.device.name)) def device_name(self): return self.__str__() device_name.short_description = "Name" class Image(models.Model): plan = models.ForeignKey('Plan', models.CASCADE, related_name="images") nrtanalysis = models.ForeignKey('NrtAnalysis', models.DO_NOTHING, blank=True, null=True, related_name="images") name = models.CharField(max_length=45, blank=True, null=True) desc = models.TextField(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) 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) class Meta: managed = True db_table = 'image' def __str__(self): return (str(self.name)) class NrtAnalysis(models.Model): name = models.CharField(max_length=45, blank=True, null=True) desc = models.TextField(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) analysis = models.TextField(blank=True, null=True) class Meta: managed = True db_table = 'nrtanalysis' verbose_name_plural = "Nrt analyzes" def __str__(self): return (str(self.name)) 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) created = models.DateTimeField(blank=True, null=True, auto_now_add=True) updated = models.DateTimeField(blank=True, null=True, auto_now=True) 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) dithering = models.BooleanField(default=False) class Meta: managed = True db_table = 'plan' def __str__(self): return (str(self.name)) class PyrosUser(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) country = models.ForeignKey(Country, models.DO_NOTHING, related_name="pyros_users") userlevel = models.ForeignKey('UserLevel', models.DO_NOTHING, related_name="pyros_users") desc = models.TextField(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) url = models.CharField(max_length=45, blank=True, null=True) tel1 = models.CharField(max_length=45, blank=True, null=True) tel2 = models.CharField(max_length=45, blank=True, null=True) address = models.CharField(max_length=45, blank=True, null=True) 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) can_del_void_req = models.BooleanField(default=False) 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" class Request(models.Model): pyros_user = models.ForeignKey('PyrosUser', models.DO_NOTHING, related_name="requests") scientificprogram = models.ForeignKey('ScientificProgram', models.DO_NOTHING, related_name="requests") name = models.CharField(max_length=45, blank=True, null=True) desc = models.TextField(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) #is_alert = models.IntegerField(blank=True, null=True) is_alert = models.BooleanField(default=False) 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) autodeposit = models.BooleanField(default=False) checkpoint = models.CharField(max_length=45, blank=True, null=True) flag = models.CharField(max_length=45, blank=True, null=True) class Meta: managed = True db_table = 'request' def __str__(self): return (str(self.name)) 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)) class ScheduleHistory(models.Model): sequences = models.ManyToManyField('Sequence', related_name='schedulehistories') 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 = 'schedulehistory' verbose_name_plural = "Schedule histories" def __str__(self): return (str(self.created)) class ScientificProgram(models.Model): pyros_users = models.ManyToManyField('PyrosUser', related_name="scientificprograms") 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) class Meta: managed = True db_table = 'scientificprogram' def __str__(self): return (str(self.name)) class Sequence(models.Model): """ Definition of Status enum values """ TOBEPLANNED = "TBP" OBSERVABLE = "OBS" UNPLANNABLE = "UNPLN" PLANNED = "PLND" EXECUTED = "EXD" REJECTED = "RJTD" INVALID = "INVL" STATUS_CHOICES = ( (TOBEPLANNED, "To be planned"), (OBSERVABLE, "Observable"), (UNPLANNABLE, "Unplannable"), (PLANNED, "Planned"), (EXECUTED, "Executed"), (REJECTED, "Rejected"), (INVALID, "Invalid"), ) request = models.ForeignKey(Request, models.CASCADE, related_name="sequences") sequencetype = models.ForeignKey('SequenceType', models.DO_NOTHING, related_name="sequences") schedule = models.ForeignKey(Schedule, models.DO_NOTHING, related_name="sequences") name = models.CharField(max_length=45, blank=True, null=True) desc = models.TextField(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) is_alert = models.BooleanField(default=False) status = models.CharField(max_length=11, blank=True, null=True, choices=STATUS_CHOICES) pointing = models.CharField(max_length=45, blank=True, null=True) with_drift = models.BooleanField(default=False) priority = models.IntegerField(blank=True, null=True) analysis_method = models.CharField(max_length=45, blank=True, null=True) 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) not_obs = models.BooleanField(default=False) obsolete = models.BooleanField(default=False) processing = models.BooleanField(default=False) flag = models.CharField(max_length=45, blank=True, null=True) tsp = models.DecimalField(default=-1.0, max_digits=15, decimal_places=8) tep = models.DecimalField(default=-1.0, max_digits=15, decimal_places=8) jd1 = models.DecimalField(default=0.0, max_digits=15, decimal_places=8) jd2 = models.DecimalField(default=0.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) 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) class Meta: managed = True db_table = 'sequence' def __str__(self): return (str(self.name)) class SequenceType(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) class Meta: managed = True db_table = 'sequencetype' def __str__(self): return (str(self.name)) class SiteWatch(models.Model): updated = models.DateTimeField(blank=True, null=True, auto_now=True) 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) class Meta: managed = True db_table = 'sitewatch' verbose_name_plural = "Site watches" def __str__(self): return (str(self.updated)) class SiteWatchHistory(models.Model): id = models.IntegerField(primary_key=True) class Meta: managed = True db_table = 'sitewatchhistory' verbose_name_plural = "Site watch histories" class StrategyObs(models.Model): name = models.CharField(max_length=45, blank=True, null=True) desc = models.TextField(blank=True, null=True) json_file = models.CharField(max_length=45, blank=True, null=True) class Meta: managed = True db_table = 'strategyobs' verbose_name_plural = "Strategy obs" def __str__(self): return (str(self.name)) 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) class Meta: managed = True db_table = 'telescope' def __str__(self): return (self.device.name) 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) class Meta: managed = True db_table = 'userlevel' def __str__(self): return (str(self.name)) 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) class Meta: managed = True db_table = 'weatherwatch' verbose_name_plural = "Weather watches" def __str__(self): return (str(self.updated)) class WeatherWatchHistory(models.Model): datetime = models.DateTimeField(blank=True, null=True, auto_now_add=True) 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) class Meta: managed = True db_table = 'weatherwatchhistory' verbose_name_plural = "Weather watch histories" def __str__(self): return (str(self.datetime))