Commit 3cc75c0f5ba8dddf515c9ef610c6bae7d88d5241
1 parent
278d0174
Exists in
master
and in
1 other branch
other tests
sqlite support (#3415) default values for booleans (#3404)
Showing
5 changed files
with
29 additions
and
22 deletions
Show diff stats
.gitignore
src/db.sqlite3
No preview for this file type
src/pyros/settings.py
... | ... | @@ -25,6 +25,9 @@ SECRET_KEY = '0*@w)$rq4x1c2w!c#gn58*$*u$w=s8uw2zpr_c3nj*u%qlxc23' |
25 | 25 | # SECURITY WARNING: don't run with debug turned on in production! |
26 | 26 | DEBUG = True |
27 | 27 | |
28 | +# Set MYSQL to False if you want to use SQLITE | |
29 | +MYSQL = True | |
30 | + | |
28 | 31 | ALLOWED_HOSTS = [] |
29 | 32 | |
30 | 33 | |
... | ... | @@ -76,20 +79,23 @@ WSGI_APPLICATION = 'pyros.wsgi.application' |
76 | 79 | # https://docs.djangoproject.com/en/1.9/ref/settings/#databases |
77 | 80 | |
78 | 81 | #EP modif |
79 | -#DATABASES = { | |
80 | - #'default': { | |
81 | - #'ENGINE': 'django.db.backends.sqlite3', | |
82 | - #'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), | |
83 | - #} | |
84 | -#} | |
85 | -DATABASES = { | |
86 | - 'default': { | |
87 | - 'ENGINE': 'django.db.backends.mysql', | |
88 | - 'NAME': 'pyros', | |
89 | - 'USER': 'root', | |
90 | - 'PASSWORD': '' | |
82 | + | |
83 | +if MYSQL == False: | |
84 | + DATABASES = { | |
85 | + 'default': { | |
86 | + 'ENGINE': 'django.db.backends.sqlite3', | |
87 | + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), | |
88 | + } | |
89 | + } | |
90 | +else: | |
91 | + DATABASES = { | |
92 | + 'default': { | |
93 | + 'ENGINE': 'django.db.backends.mysql', | |
94 | + 'NAME': 'pyros', | |
95 | + 'USER': 'root', | |
96 | + 'PASSWORD': '' | |
97 | + } | |
91 | 98 | } |
92 | -} | |
93 | 99 | |
94 | 100 | |
95 | 101 | ... | ... |
src/pyros/settings.pyc
No preview for this file type
src/pyrosapp/models.py
... | ... | @@ -43,7 +43,7 @@ class Alert(models.Model): |
43 | 43 | trigger_instrum = models.CharField(max_length=45, blank=True, null=True) |
44 | 44 | trigger_num = models.CharField(max_length=45, blank=True, null=True) |
45 | 45 | grb_error = models.CharField(max_length=45, blank=True, null=True) |
46 | - def_not_grb = models.BooleanField() | |
46 | + def_not_grb = models.BooleanField(default=False) | |
47 | 47 | editor = models.CharField(max_length=45, blank=True, null=True) |
48 | 48 | flag = models.CharField(max_length=45, blank=True, null=True) |
49 | 49 | idgcn_notice = models.IntegerField(blank=True, null=True) |
... | ... | @@ -81,7 +81,7 @@ class Detector(models.Model): |
81 | 81 | nb_photo_y = models.IntegerField(blank=True, null=True) |
82 | 82 | photo_size_x = models.IntegerField(blank=True, null=True) |
83 | 83 | photo_size_y = models.IntegerField(blank=True, null=True) |
84 | - has_shutter = models.BooleanField() | |
84 | + has_shutter = models.BooleanField(default=False) | |
85 | 85 | equivalent_foc_len = models.CharField(max_length=45, blank=True, null=True) |
86 | 86 | acq_start = models.DateTimeField(blank=True, null=True) |
87 | 87 | acq_stop = models.DateTimeField(blank=True, null=True) |
... | ... | @@ -107,7 +107,7 @@ class Device(models.Model): |
107 | 107 | desc = models.TextField(blank=True, null=True) |
108 | 108 | created = models.DateTimeField(blank=True, null=True, auto_now_add=True) |
109 | 109 | updated = models.DateTimeField(blank=True, null=True, auto_now=True) |
110 | - is_online = models.BooleanField() | |
110 | + is_online = models.BooleanField(default=False) | |
111 | 111 | status = models.CharField(max_length=11, blank=True, null=True) |
112 | 112 | maintenance_date = models.DateTimeField(blank=True, null=True) |
113 | 113 | |
... | ... | @@ -194,7 +194,7 @@ class Plan(models.Model): |
194 | 194 | position = models.CharField(max_length=45, blank=True, null=True) |
195 | 195 | exposure_time = models.FloatField(blank=True, null=True) |
196 | 196 | nb_images = models.IntegerField(blank=True, null=True) |
197 | - dithering = models.BooleanField() | |
197 | + dithering = models.BooleanField(default=False) | |
198 | 198 | |
199 | 199 | class Meta: |
200 | 200 | managed = True |
... | ... | @@ -209,7 +209,6 @@ class PyrosUser(models.Model): |
209 | 209 | country = models.ForeignKey(Country, models.DO_NOTHING, related_name="pyros_users") |
210 | 210 | userlevel = models.ForeignKey('UserLevel', models.DO_NOTHING, related_name="pyros_users") |
211 | 211 | desc = models.TextField(blank=True, null=True) |
212 | - desce = models.TextField(blank=True, null=True) | |
213 | 212 | created = models.DateTimeField(blank=True, null=True, auto_now_add=True) |
214 | 213 | updated = models.DateTimeField(blank=True, null=True, auto_now=True) |
215 | 214 | url = models.CharField(max_length=45, blank=True, null=True) |
... | ... | @@ -227,7 +226,7 @@ class PyrosUser(models.Model): |
227 | 226 | u_priority = models.IntegerField(blank=True, null=True) |
228 | 227 | p_priority = models.IntegerField(blank=True, null=True) |
229 | 228 | dir_level = models.IntegerField(blank=True, null=True) |
230 | - can_del_void_req = models.BooleanField() | |
229 | + can_del_void_req = models.BooleanField(default=False) | |
231 | 230 | |
232 | 231 | class Meta: |
233 | 232 | managed = True |
... | ... | @@ -318,11 +317,11 @@ class Sequence(models.Model): |
318 | 317 | desc = models.TextField(blank=True, null=True) |
319 | 318 | created = models.DateTimeField(blank=True, null=True, auto_now_add=True) |
320 | 319 | updated = models.DateTimeField(blank=True, null=True, auto_now=True) |
321 | - is_alert = models.BooleanField() | |
320 | + is_alert = models.BooleanField(default=False) | |
322 | 321 | status = models.CharField(max_length=11, blank=True, null=True) |
323 | 322 | duration = models.FloatField(blank=True, null=True) |
324 | 323 | pointing = models.CharField(max_length=45, blank=True, null=True) |
325 | - with_drift = models.BooleanField() | |
324 | + with_drift = models.BooleanField(default=False) | |
326 | 325 | priority = models.IntegerField(blank=True, null=True) |
327 | 326 | analysis_method = models.CharField(max_length=45, blank=True, null=True) |
328 | 327 | exec_start = models.DateTimeField() |
... | ... | @@ -332,11 +331,12 @@ class Sequence(models.Model): |
332 | 331 | type = models.CharField(max_length=6, blank=True, null=True) |
333 | 332 | img_current = models.CharField(max_length=45, blank=True, null=True) |
334 | 333 | img_total = models.CharField(max_length=45, blank=True, null=True) |
335 | - not_obs = models.BooleanField() | |
334 | + not_obs = models.BooleanField(default=False) | |
336 | 335 | obsolete = models.BooleanField(default=False) |
337 | 336 | processing = models.BooleanField(default=False) |
338 | 337 | flag = models.CharField(max_length=45, blank=True, null=True) |
339 | 338 | |
339 | + | |
340 | 340 | class Meta: |
341 | 341 | managed = True |
342 | 342 | db_table = 'sequence' | ... | ... |