@@ -62,7 +62,7 RADAR_STATES = ( | |||
|
62 | 62 | (4, 'Scheduled'), |
|
63 | 63 | ) |
|
64 | 64 | # Create your models here. |
|
65 | ||
|
65 | ||
|
66 | 66 | class Location(models.Model): |
|
67 | 67 | |
|
68 | 68 | name = models.CharField(max_length = 30) |
@@ -70,7 +70,7 class Location(models.Model): | |||
|
70 | 70 | |
|
71 | 71 | class Meta: |
|
72 | 72 | db_table = 'db_location' |
|
73 | ||
|
73 | ||
|
74 | 74 | def __unicode__(self): |
|
75 | 75 | return u'%s' % self.name |
|
76 | 76 | |
@@ -85,15 +85,15 class DeviceType(models.Model): | |||
|
85 | 85 | |
|
86 | 86 | class Meta: |
|
87 | 87 | db_table = 'db_device_types' |
|
88 | ||
|
88 | ||
|
89 | 89 | def __unicode__(self): |
|
90 | 90 | return u'%s' % self.get_name_display() |
|
91 | ||
|
91 | ||
|
92 | 92 | class Device(models.Model): |
|
93 | 93 | |
|
94 | 94 | device_type = models.ForeignKey(DeviceType, on_delete=models.CASCADE) |
|
95 | 95 | location = models.ForeignKey(Location, on_delete=models.CASCADE) |
|
96 | ||
|
96 | ||
|
97 | 97 | name = models.CharField(max_length=40, default='') |
|
98 | 98 | ip_address = models.GenericIPAddressField(protocol='IPv4', default='0.0.0.0') |
|
99 | 99 | port_address = models.PositiveSmallIntegerField(default=2000) |
@@ -102,14 +102,14 class Device(models.Model): | |||
|
102 | 102 | |
|
103 | 103 | class Meta: |
|
104 | 104 | db_table = 'db_devices' |
|
105 | ||
|
105 | ||
|
106 | 106 | def __unicode__(self): |
|
107 |
return u'[{}]: {}'.format(self.device_type.name.upper(), |
|
|
107 | return u'[{}]: {}'.format(self.device_type.name.upper(), | |
|
108 | 108 | self.name) |
|
109 | ||
|
110 |
def get_status(self): |
|
|
109 | ||
|
110 | def get_status(self): | |
|
111 | 111 | return self.status |
|
112 | ||
|
112 | ||
|
113 | 113 | @property |
|
114 | 114 | def status_color(self): |
|
115 | 115 | color = 'muted' |
@@ -121,16 +121,16 class Device(models.Model): | |||
|
121 | 121 | color = "info" |
|
122 | 122 | elif self.status == 3: |
|
123 | 123 | color = "success" |
|
124 | ||
|
124 | ||
|
125 | 125 | return color |
|
126 | ||
|
126 | ||
|
127 | 127 | def get_absolute_url(self): |
|
128 | 128 | return reverse('url_device', args=[str(self.id)]) |
|
129 | ||
|
129 | ||
|
130 | 130 | |
|
131 | 131 | class Campaign(models.Model): |
|
132 | 132 | |
|
133 |
template = models.BooleanField(default=False) |
|
|
133 | template = models.BooleanField(default=False) | |
|
134 | 134 | name = models.CharField(max_length=60, unique=True) |
|
135 | 135 | start_date = models.DateTimeField(blank=True, null=True) |
|
136 | 136 | end_date = models.DateTimeField(blank=True, null=True) |
@@ -141,64 +141,64 class Campaign(models.Model): | |||
|
141 | 141 | class Meta: |
|
142 | 142 | db_table = 'db_campaigns' |
|
143 | 143 | ordering = ('name',) |
|
144 | ||
|
144 | ||
|
145 | 145 | def __unicode__(self): |
|
146 | 146 | if self.template: |
|
147 | 147 | return u'{} (template)'.format(self.name) |
|
148 | 148 | else: |
|
149 | 149 | return u'{}'.format(self.name) |
|
150 | 150 | |
|
151 | ||
|
151 | ||
|
152 | 152 | def parms_to_dict(self): |
|
153 | ||
|
153 | ||
|
154 | 154 | import json |
|
155 | ||
|
155 | ||
|
156 | 156 | parameters = {} |
|
157 | 157 | exp_parameters = {} |
|
158 | 158 | experiments = Experiment.objects.filter(campaign = self) |
|
159 | ||
|
159 | ||
|
160 | 160 | i=1 |
|
161 | 161 | for experiment in experiments: |
|
162 | 162 | exp_parameters['experiment-'+str(i)] = json.loads(experiment.parms_to_dict()) |
|
163 | 163 | i += 1 |
|
164 | ||
|
165 | ||
|
164 | ||
|
165 | ||
|
166 | 166 | parameters['experiments'] = exp_parameters |
|
167 | 167 | parameters['end_date'] = self.end_date.strftime("%Y-%m-%d") |
|
168 | 168 | parameters['start_date'] = self.start_date.strftime("%Y-%m-%d") |
|
169 | 169 | parameters['campaign'] = self.__unicode__() |
|
170 | 170 | parameters['tags'] =self.tags |
|
171 | ||
|
171 | ||
|
172 | 172 | parameters = json.dumps(parameters, indent=2, sort_keys=False) |
|
173 | ||
|
173 | ||
|
174 | 174 | return parameters |
|
175 | ||
|
175 | ||
|
176 | 176 | def import_from_file(self, fp): |
|
177 | ||
|
177 | ||
|
178 | 178 | import os, json |
|
179 | ||
|
179 | ||
|
180 | 180 | parms = {} |
|
181 | ||
|
181 | ||
|
182 | 182 | path, ext = os.path.splitext(fp.name) |
|
183 | ||
|
183 | ||
|
184 | 184 | if ext == '.json': |
|
185 | 185 | parms = json.load(fp) |
|
186 | ||
|
186 | ||
|
187 | 187 | return parms |
|
188 | ||
|
188 | ||
|
189 | 189 | def dict_to_parms(self, parms, CONF_MODELS): |
|
190 | ||
|
190 | ||
|
191 | 191 | experiments = Experiment.objects.filter(campaign = self) |
|
192 | 192 | configurations = Configuration.objects.filter(experiment = experiments) |
|
193 | ||
|
193 | ||
|
194 | 194 | if configurations: |
|
195 | 195 | for configuration in configurations: |
|
196 | 196 | configuration.delete() |
|
197 | ||
|
197 | ||
|
198 | 198 | if experiments: |
|
199 | 199 | for experiment in experiments: |
|
200 | 200 | experiment.delete() |
|
201 | ||
|
201 | ||
|
202 | 202 | for parms_exp in parms['experiments']: |
|
203 | 203 | location = Location.objects.get(name = parms['experiments'][parms_exp]['radar']) |
|
204 | 204 | new_exp = Experiment( |
@@ -210,39 +210,39 class Campaign(models.Model): | |||
|
210 | 210 | new_exp.save() |
|
211 | 211 | new_exp.dict_to_parms(parms['experiments'][parms_exp],CONF_MODELS) |
|
212 | 212 | new_exp.save() |
|
213 | ||
|
213 | ||
|
214 | 214 | self.name = parms['campaign'] |
|
215 | 215 | self.start_date = parms['start_date'] |
|
216 | 216 | self.end_date = parms['end_date'] |
|
217 | 217 | self.tags = parms['tags'] |
|
218 | 218 | self.experiments.add(new_exp) |
|
219 | 219 | self.save() |
|
220 | ||
|
221 |
return self |
|
|
222 | ||
|
220 | ||
|
221 | return self | |
|
222 | ||
|
223 | 223 | def get_absolute_url(self): |
|
224 | 224 | return reverse('url_campaign', args=[str(self.id)]) |
|
225 | ||
|
225 | ||
|
226 | 226 | def get_absolute_url_edit(self): |
|
227 | 227 | return reverse('url_edit_campaign', args=[str(self.id)]) |
|
228 | ||
|
228 | ||
|
229 | 229 | def get_absolute_url_export(self): |
|
230 | 230 | return reverse('url_export_campaign', args=[str(self.id)]) |
|
231 | ||
|
231 | ||
|
232 | 232 | def get_absolute_url_import(self): |
|
233 | 233 | return reverse('url_import_campaign', args=[str(self.id)]) |
|
234 | ||
|
235 | ||
|
236 | ||
|
234 | ||
|
235 | ||
|
236 | ||
|
237 | 237 | class RunningExperiment(models.Model): |
|
238 | 238 | radar = models.OneToOneField('Location', on_delete=models.CASCADE) |
|
239 | 239 | running_experiment = models.ManyToManyField('Experiment', blank = True) |
|
240 | 240 | status = models.PositiveSmallIntegerField(default=0, choices=RADAR_STATES) |
|
241 | ||
|
242 | ||
|
241 | ||
|
242 | ||
|
243 | 243 | class Experiment(models.Model): |
|
244 | 244 | |
|
245 |
template = models.BooleanField(default=False) |
|
|
245 | template = models.BooleanField(default=False) | |
|
246 | 246 | name = models.CharField(max_length=40, default='', unique=True) |
|
247 | 247 | location = models.ForeignKey('Location', null=True, blank=True, on_delete=models.CASCADE) |
|
248 | 248 | start_time = models.TimeField(default='00:00:00') |
@@ -252,58 +252,58 class Experiment(models.Model): | |||
|
252 | 252 | class Meta: |
|
253 | 253 | db_table = 'db_experiments' |
|
254 | 254 | ordering = ('template', 'name') |
|
255 | ||
|
255 | ||
|
256 | 256 | def __unicode__(self): |
|
257 | 257 | if self.template: |
|
258 | 258 | return u'%s (template)' % (self.name) |
|
259 | 259 | else: |
|
260 | 260 | return u'%s' % (self.name) |
|
261 | ||
|
261 | ||
|
262 | 262 | @property |
|
263 | 263 | def radar_system(self): |
|
264 | 264 | return self.location |
|
265 | ||
|
265 | ||
|
266 | 266 | def clone(self, **kwargs): |
|
267 | ||
|
267 | ||
|
268 | 268 | confs = Configuration.objects.filter(experiment=self, type=0) |
|
269 | 269 | self.pk = None |
|
270 | 270 | self.name = '{} [{:%Y/%m/%d}]'.format(self.name, datetime.now()) |
|
271 | 271 | for attr, value in kwargs.items(): |
|
272 | 272 | setattr(self, attr, value) |
|
273 | ||
|
273 | ||
|
274 | 274 | self.save() |
|
275 | ||
|
275 | ||
|
276 | 276 | for conf in confs: |
|
277 | 277 | conf.clone(experiment=self, template=False) |
|
278 | ||
|
279 |
return self |
|
|
280 | ||
|
278 | ||
|
279 | return self | |
|
280 | ||
|
281 | 281 | def get_status(self): |
|
282 | 282 | configurations = Configuration.objects.filter(experiment=self) |
|
283 | 283 | exp_status=[] |
|
284 | 284 | for conf in configurations: |
|
285 | 285 | print conf.status_device() |
|
286 | 286 | exp_status.append(conf.status_device()) |
|
287 | ||
|
287 | ||
|
288 | 288 | if not exp_status: #No Configuration |
|
289 | 289 | self.status = 4 |
|
290 | 290 | self.save() |
|
291 |
return |
|
|
292 | ||
|
291 | return | |
|
292 | ||
|
293 | 293 | total = 1 |
|
294 | 294 | for e_s in exp_status: |
|
295 | 295 | total = total*e_s |
|
296 | ||
|
296 | ||
|
297 | 297 | if total == 0: #Error |
|
298 | 298 | status = 0 |
|
299 | 299 | elif total == (3**len(exp_status)): #Running |
|
300 | 300 | status = 2 |
|
301 | 301 | else: |
|
302 | 302 | status = 1 #Configurated |
|
303 | ||
|
303 | ||
|
304 | 304 | self.status = status |
|
305 | 305 | self.save() |
|
306 | ||
|
306 | ||
|
307 | 307 | def status_color(self): |
|
308 | 308 | color = 'muted' |
|
309 | 309 | if self.status == 0: |
@@ -314,20 +314,20 class Experiment(models.Model): | |||
|
314 | 314 | color = "success" |
|
315 | 315 | elif self.status == 3: |
|
316 | 316 | color = "warning" |
|
317 | ||
|
317 | ||
|
318 | 318 | return color |
|
319 | ||
|
319 | ||
|
320 | 320 | def get_absolute_url(self): |
|
321 | 321 | return reverse('url_experiment', args=[str(self.id)]) |
|
322 | ||
|
322 | ||
|
323 | 323 | def parms_to_dict(self): |
|
324 | ||
|
324 | ||
|
325 | 325 | import json |
|
326 | ||
|
326 | ||
|
327 | 327 | configurations = Configuration.objects.filter(experiment=self) |
|
328 | 328 | conf_parameters = {} |
|
329 | 329 | parameters={} |
|
330 | ||
|
330 | ||
|
331 | 331 | for configuration in configurations: |
|
332 | 332 | if 'cgs' in configuration.device.device_type.name: |
|
333 | 333 | conf_parameters['cgs'] = configuration.parms_to_dict() |
@@ -341,37 +341,37 class Experiment(models.Model): | |||
|
341 | 341 | conf_parameters['usrp'] = configuration.parms_to_dict() |
|
342 | 342 | if 'abs' in configuration.device.device_type.name: |
|
343 | 343 | conf_parameters['abs'] = configuration.parms_to_dict() |
|
344 | ||
|
344 | ||
|
345 | 345 | parameters['configurations'] = conf_parameters |
|
346 | 346 | parameters['end_time'] = self.end_time.strftime("%H:%M:%S") |
|
347 | 347 | parameters['start_time'] = self.start_time.strftime("%H:%M:%S") |
|
348 | 348 | parameters['radar'] = self.radar_system.name |
|
349 | 349 | parameters['experiment'] = self.name |
|
350 | 350 | parameters = json.dumps(parameters, indent=2) |
|
351 | ||
|
351 | ||
|
352 | 352 | return parameters |
|
353 | ||
|
353 | ||
|
354 | 354 | def import_from_file(self, fp): |
|
355 | ||
|
355 | ||
|
356 | 356 | import os, json |
|
357 | ||
|
357 | ||
|
358 | 358 | parms = {} |
|
359 | ||
|
359 | ||
|
360 | 360 | path, ext = os.path.splitext(fp.name) |
|
361 | ||
|
361 | ||
|
362 | 362 | if ext == '.json': |
|
363 | 363 | parms = json.load(fp) |
|
364 | ||
|
364 | ||
|
365 | 365 | return parms |
|
366 | ||
|
366 | ||
|
367 | 367 | def dict_to_parms(self, parms, CONF_MODELS): |
|
368 | ||
|
368 | ||
|
369 | 369 | configurations = Configuration.objects.filter(experiment=self) |
|
370 | ||
|
370 | ||
|
371 | 371 | if configurations: |
|
372 | 372 | for configuration in configurations: |
|
373 | 373 | configuration.delete() |
|
374 | ||
|
374 | ||
|
375 | 375 | for conf_type in parms['configurations']: |
|
376 | 376 | #--For ABS Device: |
|
377 | 377 | #--For USRP Device: |
@@ -419,194 +419,194 class Experiment(models.Model): | |||
|
419 | 419 | ) |
|
420 | 420 | confcgs_form.dict_to_parms(parms['configurations']['cgs']) |
|
421 | 421 | confcgs_form.save() |
|
422 | ||
|
423 |
location = Location.objects.get(name = parms['radar']) |
|
|
422 | ||
|
423 | location = Location.objects.get(name = parms['radar']) | |
|
424 | 424 | self.name = parms['experiment'] |
|
425 | 425 | self.location = location |
|
426 | 426 | self.start_time = parms['start_time'] |
|
427 | 427 | self.end_time = parms['end_time'] |
|
428 | 428 | self.save() |
|
429 | ||
|
429 | ||
|
430 | 430 | return self |
|
431 | ||
|
431 | ||
|
432 | 432 | def get_absolute_url_edit(self): |
|
433 | 433 | return reverse('url_edit_experiment', args=[str(self.id)]) |
|
434 | ||
|
434 | ||
|
435 | 435 | def get_absolute_url_import(self): |
|
436 | 436 | return reverse('url_import_experiment', args=[str(self.id)]) |
|
437 | ||
|
437 | ||
|
438 | 438 | def get_absolute_url_export(self): |
|
439 | 439 | return reverse('url_export_experiment', args=[str(self.id)]) |
|
440 | ||
|
441 | ||
|
440 | ||
|
441 | ||
|
442 | 442 | class Configuration(PolymorphicModel): |
|
443 | 443 | |
|
444 | 444 | template = models.BooleanField(default=False) |
|
445 | ||
|
445 | ||
|
446 | 446 | name = models.CharField(verbose_name="Configuration Name", max_length=40, default='') |
|
447 | ||
|
447 | ||
|
448 | 448 | experiment = models.ForeignKey('Experiment', verbose_name='Experiment', null=True, blank=True, on_delete=models.CASCADE) |
|
449 | 449 | device = models.ForeignKey('Device', verbose_name='Device', null=True, on_delete=models.CASCADE) |
|
450 | ||
|
450 | ||
|
451 | 451 | type = models.PositiveSmallIntegerField(default=0, choices=CONF_TYPES) |
|
452 | ||
|
452 | ||
|
453 | 453 | created_date = models.DateTimeField(auto_now_add=True) |
|
454 | 454 | programmed_date = models.DateTimeField(auto_now=True) |
|
455 | ||
|
455 | ||
|
456 | 456 | parameters = models.TextField(default='{}') |
|
457 | ||
|
457 | ||
|
458 | 458 | message = "" |
|
459 | ||
|
459 | ||
|
460 | 460 | class Meta: |
|
461 | 461 | db_table = 'db_configurations' |
|
462 | ||
|
462 | ||
|
463 | 463 | def __unicode__(self): |
|
464 | ||
|
464 | ||
|
465 | 465 | device = '{}:'.format(self.device.device_type.name.upper()) |
|
466 | ||
|
466 | ||
|
467 | 467 | if 'mix' in self._meta.get_all_field_names(): |
|
468 | 468 | if self.mix: |
|
469 |
device = '{} MIXED:'.format(self.device.device_type.name.upper()) |
|
|
470 | ||
|
469 | device = '{} MIXED:'.format(self.device.device_type.name.upper()) | |
|
470 | ||
|
471 | 471 | if self.template: |
|
472 | 472 | return u'{} {} (template)'.format(device, self.name) |
|
473 | 473 | else: |
|
474 | 474 | return u'{} {}'.format(device, self.name) |
|
475 | 475 | |
|
476 | 476 | def clone(self, **kwargs): |
|
477 | ||
|
477 | ||
|
478 | 478 | self.pk = None |
|
479 | 479 | self.id = None |
|
480 | 480 | for attr, value in kwargs.items(): |
|
481 | 481 | setattr(self, attr, value) |
|
482 | ||
|
483 |
self.save() |
|
|
482 | ||
|
483 | self.save() | |
|
484 | 484 | |
|
485 | 485 | return self |
|
486 | ||
|
486 | ||
|
487 | 487 | def parms_to_dict(self): |
|
488 | ||
|
488 | ||
|
489 | 489 | parameters = {} |
|
490 | ||
|
490 | ||
|
491 | 491 | for key in self.__dict__.keys(): |
|
492 | 492 | parameters[key] = getattr(self, key) |
|
493 | ||
|
493 | ||
|
494 | 494 | return parameters |
|
495 | ||
|
495 | ||
|
496 | 496 | def parms_to_text(self): |
|
497 | ||
|
497 | ||
|
498 | 498 | raise NotImplementedError, "This method should be implemented in %s Configuration model" %str(self.device.device_type.name).upper() |
|
499 | ||
|
499 | ||
|
500 | 500 | return '' |
|
501 | ||
|
501 | ||
|
502 | 502 | def parms_to_binary(self): |
|
503 | ||
|
503 | ||
|
504 | 504 | raise NotImplementedError, "This method should be implemented in %s Configuration model" %str(self.device.device_type.name).upper() |
|
505 | ||
|
505 | ||
|
506 | 506 | return '' |
|
507 | ||
|
507 | ||
|
508 | 508 | def dict_to_parms(self, parameters): |
|
509 | ||
|
509 | ||
|
510 | 510 | if type(parameters) != type({}): |
|
511 | 511 | return |
|
512 | ||
|
512 | ||
|
513 | 513 | for key in parameters.keys(): |
|
514 | 514 | setattr(self, key, parameters[key]) |
|
515 | ||
|
515 | ||
|
516 | 516 | def export_to_file(self, format="json"): |
|
517 | ||
|
517 | ||
|
518 | 518 | import json |
|
519 | ||
|
519 | ||
|
520 | 520 | content_type = '' |
|
521 | ||
|
521 | ||
|
522 | 522 | if format == 'text': |
|
523 | 523 | content_type = 'text/plain' |
|
524 | 524 | filename = '%s_%s.%s' %(self.device.device_type.name, self.name, self.device.device_type.name) |
|
525 | 525 | content = self.parms_to_text() |
|
526 | ||
|
526 | ||
|
527 | 527 | if format == 'binary': |
|
528 | 528 | content_type = 'application/octet-stream' |
|
529 | 529 | filename = '%s_%s.bin' %(self.device.device_type.name, self.name) |
|
530 | 530 | content = self.parms_to_binary() |
|
531 | ||
|
531 | ||
|
532 | 532 | if not content_type: |
|
533 | 533 | content_type = 'application/json' |
|
534 | 534 | filename = '%s_%s.json' %(self.device.device_type.name, self.name) |
|
535 | 535 | content = json.dumps(self.parms_to_dict(), indent=2) |
|
536 | ||
|
536 | ||
|
537 | 537 | fields = {'content_type':content_type, |
|
538 | 538 | 'filename':filename, |
|
539 | 539 | 'content':content |
|
540 | 540 | } |
|
541 | ||
|
541 | ||
|
542 | 542 | return fields |
|
543 | ||
|
543 | ||
|
544 | 544 | def import_from_file(self, fp): |
|
545 | ||
|
545 | ||
|
546 | 546 | import os, json |
|
547 | ||
|
547 | ||
|
548 | 548 | parms = {} |
|
549 | ||
|
549 | ||
|
550 | 550 | path, ext = os.path.splitext(fp.name) |
|
551 | ||
|
551 | ||
|
552 | 552 | if ext == '.json': |
|
553 | 553 | parms = json.load(fp) |
|
554 | ||
|
554 | ||
|
555 | 555 | return parms |
|
556 | ||
|
556 | ||
|
557 | 557 | def status_device(self): |
|
558 | ||
|
558 | ||
|
559 | 559 | raise NotImplementedError, "This method should be implemented in %s Configuration model" %str(self.device.device_type.name).upper() |
|
560 | ||
|
560 | ||
|
561 | 561 | return None |
|
562 | ||
|
562 | ||
|
563 | 563 | def stop_device(self): |
|
564 | ||
|
564 | ||
|
565 | 565 | raise NotImplementedError, "This method should be implemented in %s Configuration model" %str(self.device.device_type.name).upper() |
|
566 | ||
|
566 | ||
|
567 | 567 | return None |
|
568 | ||
|
568 | ||
|
569 | 569 | def start_device(self): |
|
570 | ||
|
570 | ||
|
571 | 571 | raise NotImplementedError, "This method should be implemented in %s Configuration model" %str(self.device.device_type.name).upper() |
|
572 | ||
|
572 | ||
|
573 | 573 | return None |
|
574 | ||
|
574 | ||
|
575 | 575 | def write_device(self, parms): |
|
576 | ||
|
576 | ||
|
577 | 577 | raise NotImplementedError, "This method should be implemented in %s Configuration model" %str(self.device.device_type.name).upper() |
|
578 | ||
|
578 | ||
|
579 | 579 | return None |
|
580 | ||
|
580 | ||
|
581 | 581 | def read_device(self): |
|
582 | ||
|
582 | ||
|
583 | 583 | raise NotImplementedError, "This method should be implemented in %s Configuration model" %str(self.device.device_type.name).upper() |
|
584 | ||
|
584 | ||
|
585 | 585 | return None |
|
586 | ||
|
586 | ||
|
587 | 587 | def get_absolute_url(self): |
|
588 | 588 | return reverse('url_%s_conf' % self.device.device_type.name, args=[str(self.id)]) |
|
589 | ||
|
589 | ||
|
590 | 590 | def get_absolute_url_edit(self): |
|
591 | 591 | return reverse('url_edit_%s_conf' % self.device.device_type.name, args=[str(self.id)]) |
|
592 | ||
|
592 | ||
|
593 | 593 | def get_absolute_url_import(self): |
|
594 | 594 | return reverse('url_import_dev_conf', args=[str(self.id)]) |
|
595 | ||
|
595 | ||
|
596 | 596 | def get_absolute_url_export(self): |
|
597 | 597 | return reverse('url_export_dev_conf', args=[str(self.id)]) |
|
598 | ||
|
598 | ||
|
599 | 599 | def get_absolute_url_write(self): |
|
600 | 600 | return reverse('url_write_dev_conf', args=[str(self.id)]) |
|
601 | ||
|
601 | ||
|
602 | 602 | def get_absolute_url_read(self): |
|
603 | 603 | return reverse('url_read_dev_conf', args=[str(self.id)]) |
|
604 | ||
|
604 | ||
|
605 | 605 | def get_absolute_url_start(self): |
|
606 | 606 | return reverse('url_start_dev_conf', args=[str(self.id)]) |
|
607 | ||
|
607 | ||
|
608 | 608 | def get_absolute_url_stop(self): |
|
609 | 609 | return reverse('url_stop_dev_conf', args=[str(self.id)]) |
|
610 | ||
|
610 | ||
|
611 | 611 | def get_absolute_url_status(self): |
|
612 | return reverse('url_status_dev_conf', args=[str(self.id)]) No newline at end of file | |
|
612 | return reverse('url_status_dev_conf', args=[str(self.id)]) |
@@ -21,7 +21,7 | |||
|
21 | 21 | </style> |
|
22 | 22 | <!--[if lt IE 9]> |
|
23 | 23 | <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script> |
|
24 |
<![endif]--> |
|
|
24 | <![endif]--> | |
|
25 | 25 | <script src="{% static 'js/jquery.min.js' %}"></script> |
|
26 | 26 | {% block extra-head %} |
|
27 | 27 | {% endblock %} |
@@ -39,32 +39,32 | |||
|
39 | 39 | <span class="icon-bar"></span> |
|
40 | 40 | <span class="icon-bar"></span> |
|
41 | 41 | </button> |
|
42 |
<a class="navbar-brand" href="{% url 'index' %}" style="padding-top:1px"><img class="logo" alt="JRO" src="{% static "images/logo-jro- |
|
|
42 | <a class="navbar-brand" href="{% url 'index' %}" style="padding-top:1px"><img class="logo" alt="JRO" src="{% static "images/logo-jro-color-trans.png" %}"></a> | |
|
43 | 43 | </div> |
|
44 | 44 | <div class="collapse navbar-collapse" id="navigationbar"> |
|
45 |
<ul class="nav navbar-nav"> |
|
|
45 | <ul class="nav navbar-nav"> | |
|
46 | 46 | <li class=" dropdown {% block operation-active %}{% endblock %}"><a href="{% url 'url_operation'%}">Operation</a> |
|
47 | 47 | </li> |
|
48 | 48 | <li class=" dropdown {% block new-active %}{% endblock %}"> |
|
49 |
<a href="#" class="dropdown-toggle" data-toggle="dropdown">New<span class="caret"></span></a> |
|
|
49 | <a href="#" class="dropdown-toggle" data-toggle="dropdown">New<span class="caret"></span></a> | |
|
50 | 50 | <ul class="dropdown-menu" role="menu"> |
|
51 | 51 | <li><a href="{% url 'url_add_campaign' %}">Campaign</a></li> |
|
52 | 52 | <li><a href="{% url 'url_add_experiment' %}">Experiment</a></li> |
|
53 | 53 | <li><a href="{% url 'url_add_dev_conf' 0%}">Device Configuration</a></li> |
|
54 | 54 | <li><a href="{% url 'url_add_device'%}">Device</a></li> |
|
55 | 55 | <li><a href="{% url 'url_add_location'%}">Radar System</a></li> |
|
56 |
</ul> |
|
|
56 | </ul> | |
|
57 | 57 | </li> |
|
58 | 58 | <li class=" dropdown {% block search-active %}{% endblock %}"> |
|
59 |
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Search<span class="caret"></span></a> |
|
|
59 | <a href="#" class="dropdown-toggle" data-toggle="dropdown">Search<span class="caret"></span></a> | |
|
60 | 60 | <ul class="dropdown-menu" role="menu"> |
|
61 |
<li><a href="{% url 'url_campaigns' %}">Campaigns</a></li> |
|
|
61 | <li><a href="{% url 'url_campaigns' %}">Campaigns</a></li> | |
|
62 | 62 | <li><a href="{% url 'url_experiments' %}">Experiments</a></li> |
|
63 | 63 | <li><a href="{% url 'url_dev_confs' %}">Configurations</a></li> |
|
64 | 64 | <li><a href="{% url 'url_devices' %}">Devices</a></li> |
|
65 | 65 | <li><a href="{% url 'url_locations' %}">Radar Systems</a></li> |
|
66 | 66 | </ul> |
|
67 |
</li> |
|
|
67 | </li> | |
|
68 | 68 | </ul> |
|
69 | 69 | <ul class="nav navbar-nav navbar-right"> |
|
70 | 70 | <li class="nav-divider"></li> |
@@ -78,7 +78,7 | |||
|
78 | 78 | </li> |
|
79 | 79 | {% else %} |
|
80 | 80 | <li><a href="{% url 'django.contrib.auth.views.login' %}?next={{request.get_full_path}}">Login</a></li> |
|
81 |
{% endif %} |
|
|
81 | {% endif %} | |
|
82 | 82 | </ul> |
|
83 | 83 | </div> |
|
84 | 84 | </div> |
@@ -89,15 +89,24 | |||
|
89 | 89 | <div class="container"> |
|
90 | 90 | <div id="page" class="row" style="min-height:600px"> |
|
91 | 91 | |
|
92 | <div class="col-md-3 hidden-xs hidden-sm" role="complementary"> | |
|
92 | {% if no_sidebar %} | |
|
93 | <div class="col-md-0 hidden-xs hidden-sm" role="complementary"> | |
|
94 | ||
|
95 | {% else %} | |
|
96 | <div class="col-md-3 hidden-xs hidden-sm" role="complementary"> | |
|
97 | {% endif %} | |
|
93 | 98 | <br><br> |
|
94 | 99 | <div id="sidebar"> |
|
95 |
{% block sidebar%} |
|
|
100 | {% block sidebar%} | |
|
96 | 101 | {% endblock %} |
|
97 | 102 | </div> |
|
98 | 103 | </div> |
|
99 | ||
|
100 | <div class="col-md-9 col-xs-12" role="main"> | |
|
104 | ||
|
105 | {% if no_sidebar %} | |
|
106 | <div class="col-md-12 col-xs-12" role="main"> | |
|
107 | {% else %} | |
|
108 | <div class="col-md-9 col-xs-12" role="main"> | |
|
109 | {% endif %} | |
|
101 | 110 | <div class="page-header"> |
|
102 | 111 | <h1>{% block content-title %}{% endblock %} <small>{% block content-suptitle %}{% endblock %}</small></h1> |
|
103 | 112 | </div> |
@@ -111,13 +120,14 | |||
|
111 | 120 | {% endfor %} |
|
112 | 121 | {% endif %} |
|
113 | 122 | {% endblock %} |
|
114 | ||
|
123 | ||
|
115 | 124 | {% block content %} |
|
116 | 125 | {% endblock %} |
|
117 | ||
|
126 | ||
|
118 | 127 | </div> |
|
119 | ||
|
120 | </div><!--/row--> | |
|
128 | ||
|
129 | ||
|
130 | </div><!--/row--> | |
|
121 | 131 | </div> <!-- container --> |
|
122 | 132 | |
|
123 | 133 | <div id="debug">{{debug}}</div> |
@@ -127,7 +137,7 | |||
|
127 | 137 | <div class="container"> |
|
128 | 138 | <p><hr></p> |
|
129 | 139 | <p> |
|
130 |
© <a href="http://jro.igp.gob.pe">Jicamarca Radio Observatory</a> - {% now "Y" %} |
|
|
140 | © <a href="http://jro.igp.gob.pe">Jicamarca Radio Observatory</a> - {% now "Y" %} | |
|
131 | 141 | </p> |
|
132 | 142 | </div> |
|
133 | 143 | </footer> |
@@ -140,4 +150,3 | |||
|
140 | 150 | {% endblock%} |
|
141 | 151 | </body> |
|
142 | 152 | </html> |
|
143 |
General Comments 0
You need to be logged in to leave comments.
Login now