##// END OF EJS Templates
experiment menu edition
amorales -
r358:7dca11c69628
parent child
Show More
@@ -0,0 +1,4
1 On branch master
2 Your branch is up to date with 'origin/master'.
3
4 nothing to commit, working tree clean
@@ -67,8 +67,8 class ExperimentForm(forms.ModelForm):
67
67
68 def __init__(self, *args, **kwargs):
68 def __init__(self, *args, **kwargs):
69 super(ExperimentForm, self).__init__(*args, **kwargs)
69 super(ExperimentForm, self).__init__(*args, **kwargs)
70 self.fields['start_time'].widget = TimepickerWidget(self.fields['start_time'].widget.attrs)
70 #self.fields['start_time'].widget = TimepickerWidget(self.fields['start_time'].widget.attrs)
71 self.fields['end_time'].widget = TimepickerWidget(self.fields['end_time'].widget.attrs)
71 #self.fields['end_time'].widget = TimepickerWidget(self.fields['end_time'].widget.attrs)
72
72
73 def save(self, *args, **kwargs):
73 def save(self, *args, **kwargs):
74 exp = super(ExperimentForm, self).save(*args, **kwargs)
74 exp = super(ExperimentForm, self).save(*args, **kwargs)
@@ -21,7 +21,6 from django.dispatch import receiver
21
21
22 from apps.main.utils import Params
22 from apps.main.utils import Params
23
23
24
25 DEV_PORTS = {
24 DEV_PORTS = {
26 'pedestal' : 80,
25 'pedestal' : 80,
27 'pedestal_dev' : 80,
26 'pedestal_dev' : 80,
@@ -330,13 +329,14 class RunningExperiment(models.Model):
330
329
331
330
332 class Experiment(models.Model):
331 class Experiment(models.Model):
333
332
334 template = models.BooleanField(default=False)
333 template = models.BooleanField(default=False)
335 name = models.CharField(max_length=40, default='', unique=True)
334 name = models.CharField(max_length=40, default='', unique=True)
336 location = models.ForeignKey('Location', null=False, blank=False, on_delete=models.CASCADE, default='')
335 location = models.ForeignKey('Location', null=False, blank=False, on_delete=models.CASCADE, default=None)
337 #freq = models.FloatField(verbose_name='Operating Freq. (MHz)', validators=[MinValueValidator(1), MaxValueValidator(10000)], default=49.9200)
336 #freq = models.FloatField(verbose_name='Operating Freq. (MHz)', validators=[MinValueValidator(1), MaxValueValidator(10000)], default=49.9200)
338 start_time = models.TimeField(default='00:00:00')
337 #start_time = models.TimeField(default='00:00:00')
339 end_time = models.TimeField(default='23:59:59')
338 #end_time = models.TimeField(default='23:59:59')
339 pedestal = models.ForeignKey('pedestal.PedestalConfiguration', null=False, blank=False, on_delete=models.CASCADE, default=None, related_name = "pedestal_conf")
340 task = models.CharField(max_length=36, default='', blank=True, null=True)
340 task = models.CharField(max_length=36, default='', blank=True, null=True)
341 status = models.PositiveSmallIntegerField(default=4, choices=EXP_STATES)
341 status = models.PositiveSmallIntegerField(default=4, choices=EXP_STATES)
342 author = models.ForeignKey(User, null=True, blank=True,on_delete=models.CASCADE)
342 author = models.ForeignKey(User, null=True, blank=True,on_delete=models.CASCADE)
@@ -362,7 +362,7 class Experiment(models.Model):
362 if field.name in ignored:
362 if field.name in ignored:
363 continue
363 continue
364 data[field.name] = field.value_from_object(self)
364 data[field.name] = field.value_from_object(self)
365
365
366 data['start_time'] = data['start_time'].strftime('%H:%M:%S')
366 data['start_time'] = data['start_time'].strftime('%H:%M:%S')
367 data['end_time'] = data['end_time'].strftime('%H:%M:%S')
367 data['end_time'] = data['end_time'].strftime('%H:%M:%S')
368 data['location'] = self.location.name
368 data['location'] = self.location.name
@@ -498,7 +498,7 class Experiment(models.Model):
498 )
498 )
499 conf.dict_to_parms(parms, id=id_conf)
499 conf.dict_to_parms(parms, id=id_conf)
500
500
501
501
502 location, created = Location.objects.get_or_create(name=exp_parms['location'])
502 location, created = Location.objects.get_or_create(name=exp_parms['location'])
503 self.name = '{}-{}'.format(exp_parms['name'], datetime.now().strftime('%y%m%d'))
503 self.name = '{}-{}'.format(exp_parms['name'], datetime.now().strftime('%y%m%d'))
504 self.location = location
504 self.location = location
@@ -21,10 +21,8
21 <li><a>----------------</a></li>
21 <li><a>----------------</a></li>
22 <li><a href="{{ experiment.get_absolute_url_start}}"><span class="fa fa-play" aria-hidden="true"></span> Start</a></li>
22 <li><a href="{{ experiment.get_absolute_url_start}}"><span class="fa fa-play" aria-hidden="true"></span> Start</a></li>
23 <li><a href="{{ experiment.get_absolute_url_stop }}"><span class="fa fa-stop" aria-hidden="true"></span> Stop</a></li>
23 <li><a href="{{ experiment.get_absolute_url_stop }}"><span class="fa fa-stop" aria-hidden="true"></span> Stop</a></li>
24 <li><a href="{% url 'url_mix_experiment' experiment.id %}"><span class="fa fa-random" aria-hidden="true"></span> Mix RC Configurations </a></li>
25 <li><a href="{% url 'url_add_dev_conf' experiment.id %}"><span class="fa fa-plus-circle" aria-hidden="true"></span> Add Configuration</a></li>
24 <li><a href="{% url 'url_add_dev_conf' experiment.id %}"><span class="fa fa-plus-circle" aria-hidden="true"></span> Add Configuration</a></li>
26 <li><a href="{% url 'url_sum_experiment' experiment.id %}"><span class="fa fa-list-alt" aria-hidden="true"></span> Summary</a></li>
25
27
28 </ul>
26 </ul>
29 </span>
27 </span>
30 {% endblock %}
28 {% endblock %}
@@ -576,8 +576,7 def experiments(request):
576
576
577 form = FilterForm(initial=request.GET, extra_fields=fields)
577 form = FilterForm(initial=request.GET, extra_fields=fields)
578
578
579 kwargs['keys'] = ['name', 'radar_system',
579 kwargs['keys'] = ['name', 'radar_system', 'actions']
580 'start_time', 'end_time', 'actions']
581 kwargs['title'] = 'Experiment'
580 kwargs['title'] = 'Experiment'
582 kwargs['suptitle'] = 'List'
581 kwargs['suptitle'] = 'List'
583 kwargs['no_sidebar'] = True
582 kwargs['no_sidebar'] = True
@@ -594,14 +593,13 def experiments(request):
594 def experiment(request, id_exp):
593 def experiment(request, id_exp):
595
594
596 experiment = get_object_or_404(Experiment, pk=id_exp)
595 experiment = get_object_or_404(Experiment, pk=id_exp)
597
596
598 configurations = Configuration.objects.filter(
597 configurations = Configuration.objects.filter(
599 experiment=experiment, type=0)
598 experiment=experiment, type=0)
600
599
601 kwargs = {}
600 kwargs = {}
602
601
603 kwargs['experiment_keys'] = ['template', 'radar_system',
602 kwargs['experiment_keys'] = ['template', 'radar_system', 'name']
604 'name', 'start_time', 'end_time']
605 kwargs['experiment'] = experiment
603 kwargs['experiment'] = experiment
606 kwargs['configuration_keys'] = ['name', 'device__ip_address',
604 kwargs['configuration_keys'] = ['name', 'device__ip_address',
607 'device__port_address', 'device__status']
605 'device__port_address', 'device__status']
General Comments 0
You need to be logged in to leave comments. Login now